class vB_Api_Node extends vB_Api

vB_Api_Node

Traits

Constants

FILTER_SOURCEALL

FILTER_SOURCEUSER

FILTER_SOURCEVM

FILTER_SORTMOSTRECENT

FILTER_SORTPOPULAR

FILTER_SORTFEATURED

FILTER_SORTOLDEST

FILTER_SHOWALL

FILTER_TIME

FILTER_SOURCE

FILTER_SORT

FILTER_ORDER

FILTER_SHOW

FILTER_FOLLOW

FILTER_DEPTH

REQUEST_TAKE_OWNER

REQUEST_TAKE_MODERATOR

REQUEST_TAKE_MEMBER

REQUEST_TAKE_SUBSCRIBER

REQUEST_GRANT_OWNER

REQUEST_GRANT_MODERATOR

REQUEST_GRANT_MEMBER

REQUEST_GRANT_SUBSCRIBER

REQUEST_SG_TAKE_OWNER

REQUEST_SG_TAKE_MODERATOR

REQUEST_SG_TAKE_MEMBER

REQUEST_SG_TAKE_SUBSCRIBER

REQUEST_SG_GRANT_OWNER

REQUEST_SG_GRANT_MODERATOR

REQUEST_SG_GRANT_MEMBER

REQUEST_SG_GRANT_SUBSCRIBER

OPTION_ALLOW_POST

OPTION_MODERATE_COMMENTS

OPTION_AUTOAPPROVE_MEMBERSHIP

OPTION_NODE_INVITEONLY

OPTION_NODE_PARSELINKS

OPTION_NODE_DISABLE_SMILIES

OPTION_AUTOAPPROVE_SUBSCRIPTION

OPTION_MODERATE_TOPICS

OPTION_AUTOSUBSCRIBE_ON_JOIN

OPTION_NODE_DISABLE_BBCODE

OPTION_NODE_HIDE_TITLE

OPTION_NODE_HIDE_AUTHOR

OPTION_NODE_HIDE_PUBLISHDATE

OPTION_NODE_DISPLAY_FULL_IN_CATEGORY

OPTION_NODE_DISPLAY_PAGEVIEWS

OPTION_NODE_HIDE_COMMENT_COUNT

DATE_RANGE_DAILY

DATE_RANGE_MONTHLY

Properties

protected bool $disabled Indicates whether the API was disabled from vB_Api
protected array $disableWhiteList Contains white listed methods which act as normal when API is disabled no matter of special scenarios like forum closed, password expiry, ip ban and others. from vB_Api
protected array $disableFalseReturnOnly Contains white listed methods which return a false response when API is disabled in special scenarios like forum closed, password expiry, ip ban and others. from vB_Api
protected string $controller API Controller from vB_Api
protected vB_Database $db Database object. from vB_Api
protected $contentAPIs
protected array $contentLibraries
protected vB_Library_Node $library
protected array $channelStatistics
protected $previewFields

Methods

__sleep()

No description

__wakeup()

No description

static 
getApiClassName($controller)

No description

from vB_Api
static 
getApiClassNameInternal($controller)

No description

from vB_Api
static 
getApiClass($controller, $errorCheck = true)

No description

from vB_Api
static vB_Api
instanceInternal(string $controller, bool $refresh_cache = false)

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

from vB_Api
static vB_Api
instance(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which translates exceptions to an array Use this method for API clients.

from vB_Api
static 
clearCache()

Clears all previously loaded API objects.

from vB_Api
The
callNamed()

Call the given api function by name with a named arguments list.

from vB_Api
static string
map_vb4_input_to_vb5(string $method, array $request)

Returns vb5 api method name.

from vB_Api
static 
map_vb5_output_to_vb4(string $method, array $data)

Alters the output array in any way necessary to interface correctly with vb4.

from vB_Api
static 
map_vb5_errors_to_vb4(string $method, array $data)

Alters the error array in any way necessary to interface correctly with vb4.

from vB_Api
__construct()

No description

checkApiState($method)

This method checks whether the API method is enabled.

from vB_Api
bool
isWhiteListed(string $method)

Checks if method is white listed when API is disabled.

from vB_Api
bool
isDisableFalseReturnOnly(string $method)

Checks if method returns false response only when API is disabled.

from vB_Api
toSeoFriendly(string $str)

Replaces special characters in a given string with dashes to make the string SEO friendly

from vB_Api
none
checkHasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission, and if not throws an exception

from vB_Api
boolean
hasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission

from vB_Api
checkIsLoggedIn()

Determines if the calling user has the given admin permission, and if not throws an exception

from vB_Api
setController(string $controller)

Set controller

from vB_Api
inDebugMode()

No description

from vB_Api
mixed
openNode(mixed $nodeid)

opens a node for posting

mixed
closeNode($nodeid)

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

array
deleteNodes($nodeids, $hard = true, $reason = '', $modlog = true, $reportspam = false)

Permanently/Temporarily deletes a set of nodes

deleteNodesAsSpam($nodeids, $userids = array(), $hard = true, $reason = "", $deleteother = false, $banusers = false, $banusergroupid = 0, $period = 'PERMANENT', $banreason = '', $report = false)

Delete nodes as spam

array
undeleteNodes(array $nodeids)

undeletes a set of nodes

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

Moves nodes to a new parent

array
movePosts($nodeids, string|int $to_parent, string $newtitle = '') deprecated

DEPRECATED Move multiple posts to a new topic or to a new channel. Use moveNodes function.

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

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

int
assertNodeidStr(string|int $nodestring)

Convert node path or id string to node id.

array
mergeTopics($nodeids, $targetnodeid, array $leaveRedirectData = array())

Merge several topics into a target topic

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

array
setUnFeatured(array $nodeids)

sets a node list to be not featured

boolean
clearUnpublishDate(integer $nodeid)

clears the unpublishdate flag.

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

gets one node.

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

Gets the node info for a list of nodes

mixed
getNodeAttachments(mixed $nodeids)

Gets the attachment information for a node. Which may be empty.

array
getNodeAttachmentsPublicInfo(int|int[] $nodeids)

Gets the "public" attachment information for a node. Which may be empty.

array
getAttachmentPublicInfo(int|int[] $attachmentid)

Gets the "public" attachment information for a single attachment. If the user cannot view this attachment, it will be empty. Depending on the cangetattachment or cangetimgattachment permissions, the returned data will be consumed to create an anchor, an image, or unparsed bbcode.

listNodeContent(integer $parentid, integer $page = 1, integer $perpage = 20, integer $depth = 0, mixed $contenttypeid = null, mixed $options = false)

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

mixed
listNodeFullContent(integer $parentid, integer $page = 1, integer $perpage = 20, integer $depth = 0, mixed $contenttypeid = null, mixed $options = false)

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

array("totalCount"
listNodeFullContentCount($parentid, $page = 1, $perpage = 20, $depth = 0, $contenttypeid = null, $options = false)

Lists the "total count" that can be expected from a listNodeFullContent() call with infinite $perpage param.

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

Gets the content info for a list of nodes

array
getFullContentforNodes($nodeList)

Gets the content info for a list of nodes

array
validateNodeList(array $nodes)

Given a list of nodes, removes those the user can't see.

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

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

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

This gets a content record based on nodeid including channel and starter information.

mixed
getQuoteFullContent($quoteId)

This gets a content record based on nodeid including channel and starter information.

publish(mixed $nodes)

Validates permission and sets a node to published status

unPublish($nodes, $permanent = false)

Validates permission and sets a node to unpublished status

int
addAttachment($nodeid, $data)

Adds one or more attachments

removeAttachment($nodeid, $data, $all = false)

delete one or more attachments

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

integer
fetchReportChannel()

returns id of the Report Channel

integer
fetchForumChannel()

Returns the nodeid of the root forum channel

integer
fetchInfractionChannel()

Returns the nodeid of the infraction channel

integer
fetchArticleChannel()

Returns the nodeid of the articles channel

array
listAlbums($userid = false, $page = 1, $perpage = 100, $options = array())

This returns a list of a user's albums

integer
fetchActivity(mixed $params)

returns array of all node content for a user's activity

getAlbums(int $nodeid)

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

array
setSticky(array $nodeids, boolean $stick = true)

Sets or unsets the sticky field

array
unsetSticky(array $nodeids)

Unsets sticky field

array
setApproved(array $nodeids, boolean $approved = true)

Sets or unsets the approved field

bool
setApprovedPost(int|array $nodeid, int $approved = false, array $data = array())

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

array
approve(array $nodeids)

Sets the approved field

array
unapprove(array $nodeids)

Unsets the approved field

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

This creates a request for access to a channel

approveChannelRequest(int $messageId)

Approves a channel request.

int|string
setNodeOptions($nodeid, $options = false)

Set the node options

int|string
setNodePerms(int $nodeid, array $perms = array())

Set the node special permissions

array
validateMergePosts(array $nodeIds)

Validates whether nodes can be merged and returns the merging info. If nodes cannot be merged, an error is returned.

array
getMergePostsInfo(mixed $nodeIds)

Validates whether nodes can be merged and returns merging info.

mergePosts($input)

Performs the actual merging, using edited input from UI.

getOptions()

gets the node option bitfields

mixed
listPendingPosts($options = array())

Gets the list of unapproved posts for the current user

listPendingPostsForCurrentUser($options = array())

Function wrapper for listPendingPosts but used for current user.

clearCacheEvents(array $nodeIds)

Clears the cache events from a given list of nodes.

array
markRead(int $nodeid)

Marks a node as read using the appropriate method.

array
markReadMultiple($nodeids)

Mark multiple nodes read

array
markUnreadMultiple($nodeids)

Mark multiple nodes unread

array
markChannelsRead(int $nodeid = 0)

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

array
fetchModLogs(int $nodeid)

Fetches the moderator logs for a node

array
manageDeletedNode(int $nodeid, array $params)

Manages a deleted node regarding options being passed.

inlinemodAuthCheck()

Check whether current logged-in user is "authenticated" for moderation actions.

bool
showIp($nodeid)

Checks if ip should be shown

getHostName($ip)

No description

array
fetchUseridsFromNodeids(array $nodeids) deprecated

Fetch userids from given nodeids

array
fetchUsersFromNodeids(array $nodeids)

Fetch users from given nodeids

array
fetchChannelNodeTree(integer $parentid = 0, integer $depth = 3, integer $pagenum = 1, integer $perpage = 20)

Fetch node tree structure of the specified parent id as the root. Root is excluded from the tree structure.

getGuestChannels()

Fetches a list of channels that guests can access. Basically a public access for getUserChannels() but only for userid 0.

array
getCurrentUserChannels()

Returns a list of channels that the current user can access.

getUserChannels($userid)

No description

addChannelLastData()

This takes the total tree and adds 'last' data to it

array
assembleTree(array $userTree, array $channels, int $rootid, int $depth, int $userid)

No description

addFinalBranches($trunk, $tree, $userTree, $maxDepth, $userid)

No description

array
getChannelTree()

This function builds the basic channel tree. This is global, without reference to depth or user permissions.

Array
addChannelTotals(array $channels, array $userChannels, int $channelid)

This starts at the bottom and sums the totalcount and textcount fields to topics and posts in the userChannels.

fetchChannelDetails($nodes, $nodesOnly = array())

No description

int
getNodeReadTime(int $nodeid)

Returns the node read time for the current user and the given nodeid

int
getFirstChildAfterTime(int $parentNodeId, int $timeStamp)

Returns the first immediate child node of the given node that was created after the given timestamp

mixed
incrementNodeview(int $nodeid)

Insert/Update nodeview for nodeid

array
getNodeviews(array $nodeids)

Fetch nodeview count(s) for nodeid(s), used by mergeNodeviewsForTopics() below

array
mergeNodeviewsForTopics(array $topicsArray)

Merges the nodeviews into the topics array, used by the display_Topics template

array
mergePostedStatusForTopics(array $nodes)

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

mixed
getPreviewOnly(mixed $node)

Return only the safe data for a node for which previewonly is set

array
getCreatepermissionsForEdit(array $node)

Return the specified node's createpermissions for editing for the current user

array
getCanDeleteForEdit(array $node, boolean $specific = false, boolean $hard = false)

Return whether the user can delete the node or not. Used by createcontent controller

array
getChannelStatistics(int $parentid)

Returns channel statistics-- number of topics / posts.

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

in vB_Api at line 63
static getApiClassName($controller)

Parameters

$controller

in vB_Api at line 69
static protected getApiClassNameInternal($controller)

Parameters

$controller

in vB_Api at line 97
static protected getApiClass($controller, $errorCheck = true)

Parameters

$controller
$errorCheck

in vB_Api at line 177
static vB_Api instanceInternal(string $controller, bool $refresh_cache = false)

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

Parameters

string $controller -- name of the API controller to load
bool $refresh_cache -- true if we want to force the cache to update with a new api object primarily intended for testing

Return Value

vB_Api

in vB_Api at line 203
static vB_Api instance(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which translates exceptions to an array Use this method for API clients.

Parameters

string $controller -- name of the API controller to load
bool $refresh_cache -- true if we want to force the cache to update with a new api object primarily intended for testing

Return Value

vB_Api

in vB_Api at line 237
static clearCache()

Clears all previously loaded API objects.

Intended for use in tests where the loading pattern can cause issues with objects that cache thier own data.

in vB_Api at line 259
The callNamed()

Call the given api function by name with a named arguments list.

Used primarily to translate REST requests into API calls.

Return Value

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.

in vB_Api at line 313
static string map_vb4_input_to_vb5(string $method, array $request)

Returns vb5 api method name.

May alter request array.

Parameters

string $method -- vb4 method name
array $request -- $_REQUEST array for this api request

Return Value

string

in vB_Api at line 497
static map_vb5_output_to_vb4(string $method, array $data)

Alters the output array in any way necessary to interface correctly with vb4.

Parameters

string $method -- vb4 method name
array $data -- output array from vb5

in vB_Api at line 545
static map_vb5_errors_to_vb4(string $method, array $data)

Alters the error array in any way necessary to interface correctly with vb4.

Parameters

string $method -- vb4 method name
array $data -- error array from vb5

at line 121
protected __construct()

in vB_Api at line 631
checkApiState($method)

This method checks whether the API method is enabled.

For extensions check make sure $controller property is already set.

Parameters

$method

in vB_Api at line 657
protected bool isWhiteListed(string $method)

Checks if method is white listed when API is disabled.

Parameters

string $method API method to check.

Return Value

bool Indicates whether method is or is not a white list.

in vB_Api at line 685
protected bool isDisableFalseReturnOnly(string $method)

Checks if method returns false response only when API is disabled.

Parameters

string $method API method to check.

Return Value

bool Indicates whether method returns false response only.

in vB_Api at line 712
protected toSeoFriendly(string $str)

Replaces special characters in a given string with dashes to make the string SEO friendly

Parameters

string $str The string to be converted

in vB_Api at line 734
protected none checkHasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission, and if not throws an exception

Checks for: * A valid CP Session * The passed adminpermission.

Parameters

string $adminPermission The admin permission to check

Return Value

none

Exceptions

inlinemodauth_required -- The current session is not a mod/admin session
nopermission_loggedin -- The user does not have the given permission
no_permission -- The user is not logged in at all.

in vB_Api at line 753
protected boolean hasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission

Useful if you need to know if the calling user but do not care why they do not have that permission. Generally useful if there is a behavior difference between admins and non admins, but the call can be processed for either.

Parameters

string $adminPermission The admin permission to check

Return Value

boolean true if checks pass, false otherwise

in vB_Api at line 807
protected checkIsLoggedIn()

Determines if the calling user has the given admin permission, and if not throws an exception

in vB_Api at line 821
protected setController(string $controller)

Set controller

Parameters

string $controller Controller name

in vB_Api at line 831
protected inDebugMode()

at line 134
mixed openNode(mixed $nodeid)

opens a node for posting

Parameters

mixed $nodeid integer or array of integers

Return Value

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

at line 178
mixed closeNode($nodeid)

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

$nodeid

Return Value

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

at line 225
array deleteNodes($nodeids, $hard = true, $reason = '', $modlog = true, $reportspam = false)

Permanently/Temporarily deletes a set of nodes

Parameters

$nodeids
$hard
$reason
$modlog
$reportspam

Return Value

array nodeids that were deleted

at line 393
deleteNodesAsSpam($nodeids, $userids = array(), $hard = true, $reason = "", $deleteother = false, $banusers = false, $banusergroupid = 0, $period = 'PERMANENT', $banreason = '', $report = false)

Delete nodes as spam

Parameters

$nodeids
$userids
$hard
$reason
$deleteother
$banusers
$banusergroupid
$period
$banreason
$report

at line 498
array undeleteNodes(array $nodeids)

undeletes a set of nodes

Parameters

array $nodeids The nodeids of the records to be deleted

Return Value

array nodeids that were deleted

at line 570
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 671
array movePosts($nodeids, string|int $to_parent, string $newtitle = '') deprecated

deprecated

DEPRECATED Move multiple posts to a new topic or to a new channel. Use moveNodes function.

Parameters

$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

array Moved node ids

at line 685
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 735
protected 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 748
array mergeTopics($nodeids, $targetnodeid, array $leaveRedirectData = array())

Merge several topics into a target topic

Parameters

$nodeids
$targetnodeid
array $leaveRedirectData

Return Value

array

at line 904
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 926
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 947
boolean setUnPublished(integer $nodeid)

sets a node to not published

Parameters

integer $nodeid The node id

Return Value

boolean

at line 969
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 1002
array setUnFeatured(array $nodeids)

sets a node list to be not featured

Parameters

array $nodeids The node ids

Return Value

array nodeids that have permission to be featured

at line 1014
boolean clearUnpublishDate(integer $nodeid)

clears the unpublishdate flag.

Parameters

integer $nodeid The node id

Return Value

boolean

at line 1037
Array. getNode(integer $nodeid, boolean $withParents = false, boolean $withJoinableContent = false)

gets one node.

Parameters

integer $nodeid The node id
boolean $withParents Whether to include list of parents
boolean $withJoinableContent Whether to include joinable content

Return Value

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

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

Gets the node info for a list of nodes

Parameters

array $nodeList -- array of nodeids
bool $withJoinableContent -- Include joinable content

@return array of node records

at line 1125
mixed getNodeAttachments(mixed $nodeids)

Gets the attachment information for a node. Which may be empty.

Parameters

mixed $nodeids integer or array of integers

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 1203
array getNodeAttachmentsPublicInfo(int|int[] $nodeids)

Gets the "public" attachment information for a node. Which may be empty.

Parameters

int|int[] $nodeids nodeid or array of nodeids

Return Value

array Array( {nodeid1} => array( {attachmentid1} => array(attachment information), {attachmentid2} => array(attachment information) ), {nodeid2} => array( {attachmentid3} => array(attachment information), {attachmentid4} => array(attachment information) ), ) Where attachment information contains - nodeid - parentid - filedataid - filename - filesize - settings - counter - dateline - resize_dateline - extension - userid - visible

at line 1273
array getAttachmentPublicInfo(int|int[] $attachmentid)

Gets the "public" attachment information for a single attachment. If the user cannot view this attachment, it will be empty. Depending on the cangetattachment or cangetimgattachment permissions, the returned data will be consumed to create an anchor, an image, or unparsed bbcode.

Parameters

int|int[] $attachmentid nodeid or array of nodeids

Return Value

array Array( {attachmentid1} => array(attachment information) ) Where attachment information contains - nodeid - parentid - filedataid - filename - filesize - settings - counter - dateline - resize_dateline - extension - userid - visible

at line 1396
listNodeContent(integer $parentid, integer $page = 1, integer $perpage = 20, integer $depth = 0, mixed $contenttypeid = null, mixed $options = false)

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

Parameters

integer $parentid The node id of the parent where we are listing
integer $page page number to return
integer $perpage items per page
integer $depth depth- 0 means no stopping, otherwise 1= direct child, 2= grandchild, etc
mixed $contenttypeid if desired, will only return specific content types.
mixed $options 'sort', or 'exclude' recognized.. Options flags: showVm => appends visitor message node info. Such as isVisitorMessage flag indicating if node is visitor message and vm_userInfo from the user the visitor message was posted for. withParent => appends information from the parent. This info will append the 'parentConversation' info if the node is a comment.

@return mixed   array of id's

at line 1416
mixed listNodeFullContent(integer $parentid, integer $page = 1, integer $perpage = 20, integer $depth = 0, mixed $contenttypeid = null, mixed $options = false)

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

Parameters

integer $parentid The node id of the parent where we are listing
integer $page page number to return
integer $perpage items per page
integer $depth depth- 0 means no stopping, otherwise 1= direct child, 2= grandchild, etc
mixed $contenttypeid if desired, will only return specific content types.
mixed $options 'sort', or 'exclude' recognized. Options flags: showVm => appends visitor message node info. Such as isVisitorMessage flag indicating if node is visitor message and vm_userInfo from the user the visitor message was posted for. withParent => appends information from the parent. This info will append the 'parentConversation' info if the node is a comment.

Return Value

mixed array of id's

at line 1433
array("totalCount" listNodeFullContentCount($parentid, $page = 1, $perpage = 20, $depth = 0, $contenttypeid = null, $options = false)

Lists the "total count" that can be expected from a listNodeFullContent() call with infinite $perpage param.

Used for pagination purposes. Call it with the same parameters you called listNodeFullContent() with.

Parameters

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

Return Value

array("totalCount" => integer)

at line 1467
getContentforNodes(mixed $nodeList, mixed $options = false)

Gets the content info for a list of nodes

Parameters

mixed $nodeList array of node ids
mixed $options array of options. Options flags: showVm => appends visitor message node info. Such as isVisitorMessage flag indicating if node is visitor message and vm_userInfo from the user the visitor message was posted for. withParent => appends information from the parent. This info will append the 'parentConversation' info if the node is a comment.

@return mixed   array of content records

at line 1491
array getFullContentforNodes($nodeList)

Gets the content info for a list of nodes

Parameters

$nodeList

Return Value

array array of content records -- preserves the original keys

at line 1518
protected array validateNodeList(array $nodes)

Given a list of nodes, removes those the user can't see.

Parameters

array $nodes -- list of node arrays

Return Value

array the array passed minus any $nodes that fail the test

at line 1615
array. getNodeContent(int $nodeid, int $contenttypeid = false, bool $options = array())

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

Parameters

int $nodeid
int $contenttypeid optional
bool $options optional. Options flags: showVm => appends visitor message node info. Such as isVisitorMessage flag indicating if node is visitor message and vm_userInfo from the user the visitor message was posted for. withParent => appends information from the parent. This info will append the 'parentConversation' info if the node is a comment.

Return Value

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

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

This gets a content record based on nodeid including channel and starter information.

Parameters

int $nodeid
bool $contenttypeid optional, defaults to false
array $options optional Options flags: showVm => appends visitor message node info. Such as isVisitorMessage flag indicating if node is visitor message and vm_userInfo from the user the visitor message was posted for. withParent => appends information from the parent. This info will append the 'parentConversation' info if the node is a comment.

Return Value

array node list ($nodeid=>node record) will only have one item

at line 1671
mixed getQuoteFullContent($quoteId)

This gets a content record based on nodeid including channel and starter information.

Parameters

$quoteId

Return Value

mixed

at line 1764
publish(mixed $nodes)

Validates permission and sets a node to published status

Parameters

mixed $nodes nodeid- integer or array of integers

at line 1788
unPublish($nodes, $permanent = false)

Validates permission and sets a node to unpublished status

Parameters

$nodes
$permanent

at line 1859
int addAttachment($nodeid, $data)

Adds one or more attachments

@param int

Parameters

$nodeid
$data

Return Value

int an attachid

at line 1918
removeAttachment($nodeid, $data, $all = false)

delete one or more attachments

@param int

Parameters

$nodeid
$data
$all

at line 1997
integer fetchAlbumChannel()

returns id of the Albums Channel

Return Value

integer array including

at line 2007
integer fetchPMChannel()

returns id of the Private Message Channel

Return Value

integer array including

at line 2017
integer fetchVMChannel()

returns id of the Vistor Message Channel

Return Value

integer array including

at line 2027
integer fetchReportChannel()

returns id of the Report Channel

Return Value

integer array including

at line 2037
integer fetchForumChannel()

Returns the nodeid of the root forum channel

Return Value

integer The nodeid for the root forum channel

at line 2047
integer fetchInfractionChannel()

Returns the nodeid of the infraction channel

Return Value

integer The nodeid for the infraction channel

at line 2057
integer fetchArticleChannel()

Returns the nodeid of the articles channel

Return Value

integer The nodeid for the articles channel

at line 2071
array listAlbums($userid = false, $page = 1, $perpage = 100, $options = array())

This returns a list of a user's albums

Parameters

$userid
$page
$perpage
$options

Return Value

array node list of albums

at line 2102
integer fetchActivity(mixed $params)

returns array of all node content for a user's activity

Parameters

mixed $params array- can include userid, sento, date flag, count, page, and content type.

Return Value

integer array including

at line 2182
getAlbums(int $nodeid)

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

Parameters

int $nodeid

at line 2207
array setSticky(array $nodeids, boolean $stick = true)

Sets or unsets the sticky field

Parameters

array $nodeids
boolean $stick
  • set or unset the sticky field

Return Value

array
  • the nodeids that have the permission to be changed

Exceptions

vB_Exception_Api

at line 2273
array unsetSticky(array $nodeids)

Unsets sticky field

Parameters

array $nodeids

Return Value

array
  • the nodeids that have the permission to be changed

Exceptions

vB_Exception_Api

at line 2285
array setApproved(array $nodeids, boolean $approved = true)

Sets or unsets the approved field

Parameters

array $nodeids
boolean $approved
  • set or unset the approved field

Return Value

array
  • the nodeids that have the permission to be changed

Exceptions

vB_Exception_Api

at line 2415
bool setApprovedPost(int|array $nodeid, int $approved = false, array $data = array())

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

Parameters

int|array $nodeid Int Nodeid (or an array of int nodeids) for the node(s) we are approving.
int $approved Boolean used to set or unset the approved value
array $data Optional array to update the node fields. Accepted fields are: title, rawtext, reason

Return Value

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

at line 2479
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 2490
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 2506
mixed requestChannel(int $channelid, string $requestType, mixed $recipient = 0, string $recipientname = null)

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
mixed $recipient the userid/username of the member who will get the request
string $recipientname (Optional) the username of the member who will get the request

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 2524
approveChannelRequest(int $messageId)

Approves a channel request.

Parameters

int $messageId

at line 2721
int|string setNodeOptions($nodeid, $options = false)

Set the node options

Parameters

$nodeid
$options

Return Value

int|string 1 or an error message.

at line 2744
int|string setNodePerms(int $nodeid, array $perms = array())

Set the node special permissions

Parameters

int $nodeid
array $perms with 'viewperms' and/or 'commentperms'

Return Value

int|string 1 or an error message.

at line 2801
protected array validateMergePosts(array $nodeIds)

Validates whether nodes can be merged and returns the merging info. If nodes cannot be merged, an error is returned.

Parameters

array $nodeIds

Return Value

array

at line 2857
array getMergePostsInfo(mixed $nodeIds)

Validates whether nodes can be merged and returns merging info.

Parameters

mixed $nodeIds

Return Value

array

at line 2888
mergePosts($input)

Performs the actual merging, using edited input from UI.

Parameters

$input

at line 3203
getOptions()

gets the node option bitfields

@return array associative array of bitfield name => value

at line 3219
mixed listPendingPosts($options = array())

Gets the list of unapproved posts for the current user

Parameters

$options

Return Value

mixed Array containing the pending posts nodeIds with contenttypeid associated.

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

Function wrapper for listPendingPosts but used for current user.

Parameters

$options

at line 3249
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 3260
array markRead(int $nodeid)

Marks a node as read 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 read

at line 3272
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 3284
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 3296
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 3306
array fetchModLogs(int $nodeid)

Fetches the moderator logs for a node

Parameters

int $nodeid

Return Value

array $logs list of log records

at line 3351
array manageDeletedNode(int $nodeid, array $params)

Manages a deleted node regarding options being passed.

Parameters

int $nodeid Nodeid.
array $params Options for the node managing. keys -- deletetype, reason, iconid, prefixid, topictitle, option_open, option_sticky, option_visible

Return Value

array Whether manage action succeeded or not. keys -- success

at line 3470
protected inlinemodAuthCheck()

Check whether current logged-in user is "authenticated" for moderation actions.

If the user is a moderator but not "authenticated", this will throw an exception. If the user is not a moderator, this won't throw the exception!

Exceptions

vB_Exception_Api inlinemodauth_required if we need user to login again

at line 3485
bool showIp($nodeid)

Checks if ip should be shown

Parameters

$nodeid

Return Value

bool If the ip of the poster should be posted or not

at line 3500
getHostName($ip)

Parameters

$ip

at line 3511
array fetchUseridsFromNodeids(array $nodeids) deprecated

deprecated since version 5.0.3

Fetch userids from given nodeids

Parameters

array $nodeids Node IDs

Return Value

array User IDs.

at line 3521
array fetchUsersFromNodeids(array $nodeids)

Fetch users from given nodeids

Parameters

array $nodeids Node IDs

Return Value

array User IDs and names.

at line 3554
array fetchChannelNodeTree(integer $parentid = 0, integer $depth = 3, integer $pagenum = 1, integer $perpage = 20)

Fetch node tree structure of the specified parent id as the root. Root is excluded from the tree structure.

If parentid is not specified or less than 1, it is automatically set to the top-most level special category "Forum"

Parameters

integer $parentid
integer $depth
integer $pagenum -- unused
integer $perpage -- unused

Return Value

array The node tree (need to fill out expected structure). May also contain 'warnings' => String[] of warnings to be displayed in debug mode.

at line 3614
getGuestChannels()

Fetches a list of channels that guests can access. Basically a public access for getUserChannels() but only for userid 0.

at line 3628
array getCurrentUserChannels()

Returns a list of channels that the current user can access.

This is a wrapper for getUserChannels, which shouldn't be public because then anyone could figure out the channel access permissions of any user.

Return Value

array List of channels that the current user can access.

at line 3635
protected getUserChannels($userid)

Parameters

$userid

at line 3679
protected addChannelLastData()

This takes the total tree and adds 'last' data to it

at line 3813
protected array assembleTree(array $userTree, array $channels, int $rootid, int $depth, int $userid)

Parameters

array $userTree The channel tree that's dependent on the user. Only channels visible to the current user will be present.
array $channels The COMPLETE, user-agnostic channel tree, as constructed by addChannelLastData(). Note that this function will modify this array to add user-dependent information 'topics' & 'posts, and potentially blank out some 'lastcontent' arrays, so any callers should be aware of this and pre-emptively make a copy of the array before calling this function if this array needs to stay user-independent.
int $rootid The root channel
int $depth
int $userid

Return Value

array 'channels' => list of the child channel data. May be empty if there are no children, or if user lacks view permissions.

at line 3889
protected addFinalBranches($trunk, $tree, $userTree, $maxDepth, $userid)

Parameters

$trunk
$tree
$userTree
$maxDepth
$userid

at line 3991
protected array getChannelTree()

This function builds the basic channel tree. This is global, without reference to depth or user permissions.

Return Value

array of with nodeid => array of node information including ancestry, etc.

at line 4056
protected Array addChannelTotals(array $channels, array $userChannels, int $channelid)

This starts at the bottom and sums the totalcount and textcount fields to topics and posts in the userChannels.

Parameters

array $channels array of all channel records
array $userChannels array of channel records for the current user only
int $channelid Id of the channel we are currently processing.

Return Value

Array May contain 'warnings' => String[] of warning(s)

at line 4183
fetchChannelDetails($nodes, $nodesOnly = array())

Parameters

$nodes
$nodesOnly

at line 4354
int getNodeReadTime(int $nodeid)

Returns the node read time for the current user and the given nodeid

Parameters

int $nodeid Node id

Return Value

int Read time for the node

at line 4377
int getFirstChildAfterTime(int $parentNodeId, int $timeStamp)

Returns the first immediate child node of the given node that was created after the given timestamp

Parameters

int $parentNodeId Parent Node ID
int $timeStamp Time stamp

Return Value

int Node ID

at line 4414
mixed incrementNodeview(int $nodeid)

Insert/Update nodeview for nodeid

Parameters

int $nodeid nodeid for which we should increment the view count

Return Value

mixed return true upon completion, or an error message

at line 4437
protected array getNodeviews(array $nodeids)

Fetch nodeview count(s) for nodeid(s), used by mergeNodeviewsForTopics() below

Parameters

array $nodeids array of nodeid(s) for which we're grabbing the count(s)

Return Value

array array with keys $nodeids & corresponding counts for the values array( => , => ...)

at line 4468
array mergeNodeviewsForTopics(array $topicsArray)

Merges the nodeviews into the topics array, used by the display_Topics template

Parameters

array $topicsArray search results array with nodeids for keys, and each element having a 'content' array

Return Value

array array with keys $nodeids & corresponding counts for the values array( => , => ...)

at line 4502
array mergePostedStatusForTopics(array $nodes)

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 current user has posted in the topic (replies and comments); zero if none.

Parameters

array $nodes Nodes

Return Value

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

at line 4517
mixed getPreviewOnly(mixed $node)

Return only the safe data for a node for which previewonly is set

Parameters

mixed $node Existing node data

Return Value

mixed Cleaned node data

at line 4542
array getCreatepermissionsForEdit(array $node)

Return the specified node's createpermissions for editing for the current user

Parameters

array $node existing node data array including nodeid, starter, channelid, contenttypeid

Return Value

array key 'createpermissions': boolean false if they cannot edit the node an array with keys contenttypes => integer 1 if they can create the specified contenttype, 0 if they cannot

at line 4596
array getCanDeleteForEdit(array $node, boolean $specific = false, boolean $hard = false)

Return whether the user can delete the node or not. Used by createcontent controller

Parameters

array $node Existing node data array including nodeid, starter, channelid, contenttypeid
boolean $specific (OPTIONAL) Whether to specifically check for hard delete or soft delete. By default it is false, meaning it will check whether user can soft OR hard delete the node
boolean $hard (OPTIONAL) Only used if $specific is true. Whether it's checking if user can hard delete (true) or soft delete (false)

Return Value

array key 'candelete': boolean true if they can delete the node

at line 4643
array getChannelStatistics(int $parentid)

Returns channel statistics-- number of topics / posts.

This function depends on fetchChannelNodeTree, which populates channelStatistics.

Parameters

int $parentid Parent node id

Return Value

array Channel statistics.