class vB_Library_Content_Privatemessage extends vB_Library_Content_Text

vB_Library_Content_Privatemessage

Traits

Constants

ACTION_ADD

ACTION_UPDATE

ACTION_VIEW

ACTION_DELETE

ACTION_APPROVE

ACTION_PUBLISH

CACHELEVEL_NODE

CACHELEVEL_CONTENT

CACHELEVEL_FULLCONTENT

TRASH_FOLDER

REQUEST_FOLDER

MESSAGE_FOLDER

NOTIFICATION_FOLDER

PENDING_FOLDER

SENT_FOLDER

INFRACTION_FOLDER

DELETED_ITEMS_FOLDER

NOTIFICATION_TYPE_VOTE

NOTIFICATION_TYPE_VOTEREPLY

NOTIFICATION_TYPE_RATE

NOTIFICATION_TYPE_REPLY

NOTIFICATION_TYPE_FOLLOW

NOTIFICATION_TYPE_FOLLOWING

NOTIFICATION_TYPE_VM

NOTIFICATION_TYPE_COMMENT

NOTIFICATION_TYPE_THREADCOMMENT

NOTIFICATION_TYPE_SUBSCRIPTION

NOTIFICATION_TYPE_MODERATE

NOTIFICATION_TYPE_USERMENTION

Properties

static protected $instance from vB_Library
protected $contenttype
protected $contenttypeid from vB_Library_Content
protected $tablename
protected $index_fields from vB_Library_Content_Text
protected $textCountChange from vB_Library_Content_Text
protected $inheritViewPerms from vB_Library_Content_Text
protected $inlist from vB_Library_Content
protected $showSignature from vB_Library_Content_Text
protected $doFloodCheck from vB_Library_Content
protected $assertor from vB_Library_Content
protected $nodeApi
protected $nodeLibrary from vB_Library_Content
static protected $cacheNodes Whether we are caching node content from vB_Library_Content
protected $channelTypeId from vB_Library_Content
protected $cannotDelete from vB_Library_Content
protected $qryAfterAdd from vB_Library_Content
protected $allCanview from vB_Library_Content
protected bool $includeInUserPostCount If true, then creating a node of this content type will increment the user's post count. If false, it will not. Generally, this should be true for topic starters and replies, and false for everything else.
static protected $defaultNodeOptions from vB_Library_Content
protected bool $doIncompleteNodeCleanup from vB_Library_Content
protected $bbcode_parser from vB_Library_Content_Text
protected $spamType from vB_Library_Content_Text
protected $spamKey from vB_Library_Content_Text
protected $folders
protected $pmChannel
protected $canSee
protected $foldersInfo
protected $notificationTypes
protected $channelRequests
protected $channelFollowRequests
protected $skipModNotification

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

reloadOptions()

Reload options from datastore. Currently only used by unit tests.

fetchContentType()

No description

getAllCanView()

No description

fetchContentTypeId()

No description

int
getTextCountChange()

Returns textCountChange property

int
getInlist()

Returns inlist property

add(mixed $data, array $options = array(), bool $convertWysiwygTextToBbcode = true)

This adds a new message

beforeCommit($nodeid, $data, $options, $cacheEvents, $nodevals)

Called by the first child class just before the commit happens.

afterAdd(int $nodeid, mixed $data, mixed $options, mixed $cacheEvents, mixed $nodevals)

Operations to be done after adding a node. Putting actions here allow child classes to minimize time keeping transaction open.

sendModeratorNotification($nodeid)

Sends emails to moderators configured in admincp

needsFloodCheck($data, $options)

No description

checkFloodAndThrowException($data)

No description

string|boolean
duplicateCheck(array $data)

Checks accidental duplicate posting

updateNodeOptions($nodeid, $data)

Sets node options from individual fields.

incrementUserPostCount(array $node)

Increments the number of posts for a user. This function will also update user's "lastpost" field

decrementUserPostCount(array $node, (unpublish|unapprove) $action = '')

Decrements the number of posts for a user

resetCountCalled()

Reset the called array- this makes sure we only increment/decrement user post counts once for a given node This is only needed by the unit tests.

boolean
countInUserPostCount(array $node, (unpublish|unapprove) $action = '')

Checks if the current node should be counted in the user post count for the author.

boolean
shouldChangeUserPostCountForChildNodes(array $node, (unpublish|unapprove) $action = '')

Checks whether or not we should adjust user post count for descendant nodes

boolean
delete(integer $nodeid)

Permanently deletes a node

deleteChildren(array $childrenIds)

Delete the records without updating the parent info. It is used when deleting a whole channel and it's children need to be removed

bool
isPublished(mixed $data)

Is this record in a published state based on the times?

update(int $nodeid, array $data, bool $convertWysiwygTextToBbcode = true)

Updates a text node.

static mixed
getContentApi(int $contenttypeid)

Returns a content api of the appropriate type

static mixed
getContentLib(int $contenttypeid)

Returns a content api of the appropriate type

int
getContent($nodeids)

Returns the node content as an associative array

Array[Int]
getBareContent(integer $nodeids)

Returns the node content plus the channel routeid and title, and starter route and title the as an associative array Caller MUST ensure that $nodeids are of the correct content type.

array
getFullContent($nodeid, array $permissions = false)

Returns the node content as an associative array

array
getRawContent($nodeids)

Prepares basic content. Used by both getBareContent and getFullContent.

bool
getCanEdit(int $node, int $userContext = null, mixed $channelPerms = array())

Determines whether the current user can edit a node

bool
getCanDelete(mixed $node, int $userContext = null, mixed $channelPerms = array(), bool $hard = false)

Determines whether the current user can soft-delete or hard-delete

bool
getCanModerate(mixed $node, object $userContext = null, mixed $channelPerms = array(), int $nodeid = 0)

Determines whether the current user can moderate

Array
assembleContent(Array $content, mixed $permissions = false)

Assembles the response for detailed content

getIndexableFromNode($content, $include_attachments = true)

No description

array
getIndexableContent($nodeId, $include_attachments = true)

The classes that inherit this should implement this function It should return the content that should be indexed If there is a title field, the array key for that field should be 'title', the rest of the text can have any key

int
getStarter(int $nodeid)

Gets the conversation starter for a node. If the node is a channel it returns the channelid.

array
getConversationParent(int $nodeid)

Gets the conversation starter for a node. If the node is a channel it returns the channel record.

bool
isVisitorMessage(int $nodeid)

determines whether a specific node is a visitor message

bool
isComment(int $nodeid, array $node = null)

Determines whether a specific node is a comment on a thread reply or not

getIndexableContentForAttachments($nodeId)

Get the indexable content for attachments. Separate this so that child classes can rewrite getIndexableContent entirely without having to copy as much code

Array
fetchTableName()

returns the tables used by this content type.

static array('found'
fetchFromCache(array|int $nodeids, integer $level)

This attempts to get the cached data for nodes

static void
writeToCache($nodes, $level)

writes new cached data for nodes

verifyPrefixid($prefixid)

No description

verifyPostIconid(int $posticonid)

Verifies that the post iconid is valid

changeContentType($nodeid, $oldcontentType, $newcontentType)

No description

string
getDuplicateHash(array $data)

Calculates the CRC based on the indexable content

fillContentTableData($node)

No description

none
removePrivateDataFromNode(array $node)

Examines the node record returned from the node library and determines if any information needs to be removed before passing beyond the API layer.

bool
checkComplete(array $node)

This function checks to see if a node is valid, and if not it deletes or fixes it.

boolean
getCannotDelete()

Whether this type can be deleted. Infractions, for example, cannot be.

bool
getNodeClean(integer $node)

Checks to see if the node has all the required data.

bool
incompleteNodeCleanup(mixed $node)

This cleans up for a node that was found to be incomplete by deleting the child nodes and subsidiary table records

setDoIncompleteNodeCleanup(bool $value)

Sets the $doIncompleteNodeCleanup flag

handleAttachments($type, $nodeid, $data, $options = array())

Handles uploaded attachments-- Adds the attach nodes and handles updating data that needs updating after the attachments are added.

mergeContentInfo($result, $content)

Adds content info to $result so that merged content can be edited.

bool
validate($data, $action = vB_Library_Content::ACTION_ADD, $nodeid = false, $nodes = false, $userid = null)

Validates the data according to the action to be taken

addContentInfo($results)

No description

postBbcodeParseCleanRawtext(mixed $data)

Cleans the input in the $data array, specifically after any html/wysiwyg -> bbcode parsing.

parseAndStrip($text)

No description

replaceAndStripBbcode($text, $data = array())

No description

array|string
getQuotes(array|int $nodeids)

This returns a string with quoted strings in bbcode format.

getQuotesFromNodes(array $nodes)

Helper function to allow getQuotes in the API and Library classes to generate the node list independantly (so that the API can check perms without loading the nodes twice).

type
mergeContent(type $data)

Performs the merge of content and updates the node.

fixAttachBBCode(mixed $nodeId, array $content = null, array $keysToAttachid = array()) deprecated

DEPRECATED: This needs to remain until the corresponding API function is removed

string
replaceAttachBbcodeForParseAndStrip(string $rawtext, array $data = array())

Replace [attach], [img] or [img2] bbcode with a plaintext keyword for use in meta description.

string
replaceAttachBbcodeTempids(string $rawtext, array $keysToAttachid)

Replaces the tempids in [attach] bbcodes with the nodeid/attachid for the attachment.

autoPopulatePreviewImage(int $nodeId, array $node = null) deprecated

DEPRECATED: This needs to remain until the corresponding API function is removed

int|bool
getPreviewImage(array $node)

Determines the best attachment to use for the preview image and returns the attachid/nodeid.

int
addMessageNoFlood(array $data, array $options = array())

Adds a message without triggering the flood check.

sendEmailNotification(array $data)

Sends the email notication for a private message

checkCanReceivePM($recipient)

No description

bool
moveMessage($nodeid, $newFolderid, $existing)

Moves a message to a different folder

mixed
getMessage(int $nodeid)

Get a message

array
getRequest(int $nodeid)

Get a single request

array
getMessageTree($nodeid, $exclude, $userid)

Get a message and all replies and sets the message to "read"

mixed
listFolders(mixed $suppress = array())

This lists the folders.

int
createMessageFolder($folderName, $userid)

This creates a new message folder. It returns false if the record already exists and the id if it is able to create the folder

toTrashcan(int $nodeid)

Moves a node to the trashcan. Wrapper for deleteMessage()

mixed
fetchSummary($userid)

This summarizes messages for specified user

array
listMessages($data, $userid)

This lists messages for current user

Array
listNotifications(Array $data, Int $userid) deprecated

No description

mixed
listSpecialPrivateMessages(mixed- $data = array())

This lists messages for current user

bool
deleteMessage($nodeid, $userid = false)

Permanently deletes a message

int
deleteMessagesForUser(int $userid)

Deletes all pms for a given user

deleteSentMessagesForUser($userid)

No description

array
checkFolders(int $userid, bool $skipNonExistentRecipients = false)

This function checks that we have all the folders for the current user, and the set folders are there.

array
validateRequest(int $userid, int $nodeid)

Verifies that the request exists and its valid.

array
denyRequest(int $nodeid, int $cancelRequestFor)

This function denies a user follow request

bool
acceptRequest(int $nodeid)

This function accepts a user follow request or a channel ownership/moderation/membership request

resetFolders()

Clears the cached folder information

fetchFolders($userid)

returns the cached folder information

setRead($nodeid, $read, $userid, $folderKey = false)

This sets a message to read

unsetFolders($userid)

returns the cached folder information

int
checkCanSee(mixed $nodeids)

Checks nodes to ensure that the current user can see them.

mixed
addMessageInfo(mixed $nodes)

Returns the node content as an associative array

int
getPendingPostFolderId()

Get the pending posts folder id

int
getInfractionFolderId()

Get the infraction folder id

int
getDeletedItemsFolderId()

Get the deleted_items folder id

mixed
getChannelRequestTypes()

Returns array of Request message types

mixed
fetchNotificationTypes()

Return all the valid notification types

bool
undeleteMessage($nodeid, $existing)

Move a message back to user inbox folder

bool
deleteMessages($nodeids)

Delete messages

bool
moveUndeleted(int $nodeid, int $newFolderid, int $existing)

Move messages to inbox marking them as undeleted.

array
getFolderFromId($folderid, $userid)

Gets the folder information from a given folderid. The folderid requested should belong to the user who is requesting.

buildPmTotals(array|int $userids)

Calculates the number of private messages that a user has in the system Used to limit pm abilities based on overage of this count

boolean
userReceivesNotification($userid, $notificationType)

Checks if userid's notification options for notification type

String|Bool
convertLegacyNotificationAboutString(String $aboutString)

Translates the legacy notification type string into the new notification typename

String
convertNotificationTypeToLegacyAboutString(String $typename)

Translates the legacy notification type string into an array of type information

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

at line 111
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()

in vB_Library_Content at line 158
reloadOptions()

Reload options from datastore. Currently only used by unit tests.

in vB_Library_Content at line 163
fetchContentType()

in vB_Library_Content at line 172
getAllCanView()

in vB_Library_Content at line 177
fetchContentTypeId()

in vB_Library_Content at line 186
int getTextCountChange()

Returns textCountChange property

Return Value

int

in vB_Library_Content at line 195
int getInlist()

Returns inlist property

Return Value

int

at line 249
add(mixed $data, array $options = array(), bool $convertWysiwygTextToBbcode = true)

This adds a new message

Parameters

mixed $data Array of field => value pairs which define the record. Data-types & key names: int 'parentid' Nodeid of the parent, i.e. node this attachment is being added under. int 'userid' Optional. Userid of the user who is adding this record. If not provided, it will use the current session's user. string 'authorname' Optional. Name of the user who is adding this record. If not provided, it will use the username of userid above. string 'ipaddress' Optional. IP of request. Will be fetched from current request if skipped. ??? 'protected' ??? int 'starter' ??? int 'routeid' ??? ??? 'prefixid' ??? ??? 'iconid' ??? int 'created' Optional. Unix timestamp of creation date. If skipped it will use the value returned by vB::getRequest()->getTimeNow() (TIMENOW). int 'publishdate' Optional. Unix timestampe of publish date. If skipped, it will use TIMENOW. If 'publish_now' is provided, publishdate will be overwritten by TIMENOW mixed 'publish_now' Optional. If not empty, publishdate will be overwritten by TIMENOW ??? 'viewperms' ??? ??? 'featured' Optional. ???(purpose/description)??? Will only be used if the CURRENT USER has the moderatorpermissions.cansetfeatured channel permission. string 'title' ??? string 'htmltitle' ??? string 'urlident' ??? int 'setfor' Only used by visitor messages. Userid of intended visitor message recipient. ??? ??? ??? Can also contain node fields. see vB_Library_Node::getNodeFields() or the node table structure for these fields
array $options Array of options for the content being created. Understands skipTransaction, skipFloodCheck, floodchecktime, many subclasses have skipNotification.

@return mixed       array with nodeid (int), success (bool), cacheEvents (array of strings), nodeVals (array of field => value).
bool $convertWysiwygTextToBbcode Convert text to bbcode

in vB_Library_Content at line 852
protected beforeCommit($nodeid, $data, $options, $cacheEvents, $nodevals)

Called by the first child class just before the commit happens.

This is for logic that needs to be in the transaction, but relies on the child class having finished all of its processing (the flow is that content::add gets called first and then the child does it's thing, primary because the child needs the nodeid for the created node record).

Takes the same parameters as afterAdd

Parameters

$nodeid
$data
$options
$cacheEvents
$nodevals

in vB_Library_Content at line 877
protected afterAdd(int $nodeid, mixed $data, mixed $options, mixed $cacheEvents, mixed $nodevals)

Operations to be done after adding a node. Putting actions here allow child classes to minimize time keeping transaction open.

Parameters

int $nodeid
mixed $data Array of data being added
mixed $options Array of options for the content being created- passed from add() Understands skipNotification(s), skipUpdateLastContent.
mixed $cacheEvents Array of strings- cache events to be called
mixed $nodevals Array of field => value pairs representing the node table field values passed to create the record. Currently most are not used but all are passed.

in vB_Library_Content at line 1132
protected sendModeratorNotification($nodeid)

Sends emails to moderators configured in admincp

Parameters

$nodeid

at line 673
protected needsFloodCheck($data, $options)

Parameters

$data
$options

at line 709
protected checkFloodAndThrowException($data)

Parameters

$data

at line 764
protected string|boolean duplicateCheck(array $data)

Checks accidental duplicate posting

Parameters

array $data

Return Value

string|boolean hash or false if check skipped

in vB_Library_Content at line 1399
protected updateNodeOptions($nodeid, $data)

Sets node options from individual fields.

@param int

Parameters

$nodeid
$data

in vB_Library_Content at line 1435
incrementUserPostCount(array $node)

Increments the number of posts for a user. This function will also update user's "lastpost" field

When creating items, this is called from the content library, For all other state changes (approve, undelete, etc) it is called from the node library

Parameters

array $node Array of node information for the affected node

in vB_Library_Content at line 1492
decrementUserPostCount(array $node, (unpublish|unapprove) $action = '')

Decrements the number of posts for a user

When hard-deleting items, this is called from the content library, For all other state changes (unapprove, soft-delete, etc) it is called from the node library

Parameters

array $node Array of node information for the affected node
(unpublish|unapprove) $action Pass one of these strings when decrementUserPostCount is called after unpublishing or unapproving a post

in vB_Library_Content at line 1541
resetCountCalled()

Reset the called array- this makes sure we only increment/decrement user post counts once for a given node This is only needed by the unit tests.

in vB_Library_Content at line 1554
protected boolean countInUserPostCount(array $node, (unpublish|unapprove) $action = '')

Checks if the current node should be counted in the user post count for the author.

Parameters

array $node The node
(unpublish|unapprove) $action The action that was just carried out on the node

Return Value

boolean Whether or not the node should be counted in user post count.

in vB_Library_Content at line 1605
protected boolean shouldChangeUserPostCountForChildNodes(array $node, (unpublish|unapprove) $action = '')

Checks whether or not we should adjust user post count for descendant nodes

Parameters

array $node The node
(unpublish|unapprove) $action The action that was just carried out on the node

Return Value

boolean Whether or not the child nodes should be handled

at line 780
boolean delete(integer $nodeid)

Permanently deletes a node

Parameters

integer $nodeid The nodeid of the record to be deleted

Return Value

boolean

at line 872
deleteChildren(array $childrenIds)

Delete the records without updating the parent info. It is used when deleting a whole channel and it's children need to be removed

Parameters

array $childrenIds
  • list of node ids

in vB_Library_Content at line 1822
bool isPublished(mixed $data)

Is this record in a published state based on the times?

Parameters

mixed $data

Return Value

bool

update(int $nodeid, array $data, bool $convertWysiwygTextToBbcode = true)

Updates a text node.

Parameters

int $nodeid
array $data information to update the content with

@return boolean
bool $convertWysiwygTextToBbcode Flag instructing us to convert rawtext from WYSIWYG editor markup to BBCode.

in vB_Library_Content at line 2366
static mixed getContentApi(int $contenttypeid)

Returns a content api of the appropriate type

Parameters

int $contenttypeid the content type id

Return Value

mixed content api object

in vB_Library_Content at line 2377
static mixed getContentLib(int $contenttypeid)

Returns a content api of the appropriate type

Parameters

int $contenttypeid the content type id

Return Value

mixed content api object

in vB_Library_Content at line 2395
int getContent($nodeids)

Returns the node content as an associative array

Parameters

$nodeids

Return Value

int

in vB_Library_Content at line 2410
Array[Int] getBareContent(integer $nodeids)

Returns the node content plus the channel routeid and title, and starter route and title the as an associative array Caller MUST ensure that $nodeids are of the correct content type.

Parameters

integer $nodeids The id in the primary table.

Return Value

Array[Int] Requested data, keyed by the nodeid.

at line 2187
array getFullContent($nodeid, array $permissions = false)

Returns the node content as an associative array

Parameters

$nodeid
array $permissions permissions

Return Value

array Nodeid-keyed array of node content, including node.*, channel & starter id, title, route and other common data, and content-specific data. see $this->getRawContent()

in vB_Library_Content at line 2473
protected array getRawContent($nodeids)

Prepares basic content. Used by both getBareContent and getFullContent.

Parameters

$nodeids

Return Value

array Nodeid-keyed array of node & content data, including node table data. Keys depend on the particular node's contenttype, but a few common ones include: node.*, channelroute, channeltitle, channelid, starterroute, startertitle, etc. See vBForum:getFullContent.

Exceptions

throw new vB_Exception_Api('incorrect_content_class_called') If any node in $nodeids is not of $this's contenttype.

in vB_Library_Content at line 2598
bool getCanEdit(int $node, int $userContext = null, mixed $channelPerms = array())

Determines whether the current user can edit a node

Parameters

int $node The nodeid
int $userContext optional usercontext
mixed $channelPerms optional array of channel permissions data, which if available prevents a userContext Call

Return Value

bool

in vB_Library_Content at line 2724
bool getCanDelete(mixed $node, int $userContext = null, mixed $channelPerms = array(), bool $hard = false)

Determines whether the current user can soft-delete or hard-delete

Parameters

mixed $node The node
int $userContext Optional usercontext
mixed $channelPerms Optional array of channel permissions data, which if available prevents a userContext Call
bool $hard Optional flag - false get can soft delete, true get can hard delete

Return Value

bool

in vB_Library_Content at line 2880
bool getCanModerate(mixed $node, object $userContext = null, mixed $channelPerms = array(), int $nodeid = 0)

Determines whether the current user can moderate

Parameters

mixed $node The node
object $userContext optional usercontext
mixed $channelPerms optional array of channel permissions data, which if available prevents a userContext Call
int $nodeid optional nodeid,

Return Value

bool

Array assembleContent(Array $content, mixed $permissions = false)

Assembles the response for detailed content

Parameters

Array $content getRawContent() response array. Each element is a nodeid-keyed array. Each subarray must have the following data at minimum: nodeid, channelid, contenttypeid, starter, showopen, userid, setfor (if VM), nodeoptions
mixed $permissions optional array of permissions

Return Value

Array Nodeid-keyed array of the $content data, plus additional data such as contenttypeclass, createpermissions, moderatorperms, channeltype, permissions, etc, @TODO: complete this list Also the expanded nodeoptions of: allow_post, moderate_comments, approve_membership, invite_only, autoparselinks, disablesmilies, disable_bbcode, hide_title, hide_author, hide_publishdate, display_fullincategory, display_pageviews, hide_comment_count

getIndexableFromNode($content, $include_attachments = true)

Parameters

$content
$include_attachments

in vB_Library_Content at line 3540
array getIndexableContent($nodeId, $include_attachments = true)

The classes that inherit this should implement this function It should return the content that should be indexed If there is a title field, the array key for that field should be 'title', the rest of the text can have any key

Parameters

$nodeId
$include_attachments

Return Value

array $indexableContent

in vB_Library_Content at line 3586
int getStarter(int $nodeid)

Gets the conversation starter for a node. If the node is a channel it returns the channelid.

Parameters

int $nodeid

Return Value

int The conversation starter's nodeid

in vB_Library_Content at line 3619
array getConversationParent(int $nodeid)

Gets the conversation starter for a node. If the node is a channel it returns the channel record.

Parameters

int $nodeid

Return Value

array The starter node array

in vB_Library_Content at line 3640
bool isVisitorMessage(int $nodeid)

determines whether a specific node is a visitor message

Parameters

int $nodeid

Return Value

bool

in vB_Library_Content at line 3657
bool isComment(int $nodeid, array $node = null)

Determines whether a specific node is a comment on a thread reply or not

Parameters

int $nodeid Node ID
array $node Node information

Return Value

bool

in vB_Library_Content at line 3681
protected getIndexableContentForAttachments($nodeId)

Get the indexable content for attachments. Separate this so that child classes can rewrite getIndexableContent entirely without having to copy as much code

Parameters

$nodeId

in vB_Library_Content at line 3702
Array fetchTableName()

returns the tables used by this content type.

Return Value

Array

in vB_Library_Content at line 3719
static array('found' fetchFromCache(array|int $nodeids, integer $level)

This attempts to get the cached data for nodes

Parameters

array|int $nodeids
integer $level -- one of the constants for level of data

Return Value

array('found' => array of node values per the constant, 'notfound' => array of nodeids);

in vB_Library_Content at line 3796
static void writeToCache($nodes, $level)

writes new cached data for nodes

Note that this is affected by the 'cache_node_data' admin option. If that is not true then this function does nothing.

Parameters

$nodes
$level

Return Value

void

in vB_Library_Content at line 3816
protected verifyPrefixid($prefixid)

Parameters

$prefixid

in vB_Library_Content at line 3840
protected verifyPostIconid(int $posticonid)

Verifies that the post iconid is valid

Parameters

int $posticonid post icon ID

in vB_Library_Content at line 3854
protected changeContentType($nodeid, $oldcontentType, $newcontentType)

Parameters

$nodeid
$oldcontentType
$newcontentType

in vB_Library_Content at line 3894
protected string getDuplicateHash(array $data)

Calculates the CRC based on the indexable content

Parameters

array $data

Return Value

string

in vB_Library_Content at line 3930
protected fillContentTableData($node)

Parameters

$node

in vB_Library_Content at line 3953
none removePrivateDataFromNode(array $node)

Examines the node record returned from the node library and determines if any information needs to be removed before passing beyond the API layer.

This is part of the library layer because its needed for a number of API classes that return node data in various forms.

Parameters

array $node the node array to be cleaned.

Return Value

none

in vB_Library_Content at line 3974
bool checkComplete(array $node)

This function checks to see if a node is valid, and if not it deletes or fixes it.

Parameters

array $node -- node array

Return Value

bool

in vB_Library_Content at line 3996
boolean getCannotDelete()

Whether this type can be deleted. Infractions, for example, cannot be.

Return Value

boolean

in vB_Library_Content at line 4008
protected bool getNodeClean(integer $node)

Checks to see if the node has all the required data.

Parameters

integer $node the nodeid to be checked

Return Value

bool

at line 2461
bool incompleteNodeCleanup(mixed $node)

This cleans up for a node that was found to be incomplete by deleting the child nodes and subsidiary table records

Parameters

mixed $node Node record, which may have missing child table data.

Return Value

bool Whether the node has been cleaned up

in vB_Library_Content at line 4095
setDoIncompleteNodeCleanup(bool $value)

Sets the $doIncompleteNodeCleanup flag

Parameters

bool $value Flag value

in vB_Library_Content_Text at line 1035
protected handleAttachments($type, $nodeid, $data, $options = array())

Handles uploaded attachments-- Adds the attach nodes and handles updating data that needs updating after the attachments are added.

Parameters

$type
$nodeid
$data
$options

mergeContentInfo($result, $content)

Adds content info to $result so that merged content can be edited.

Parameters

$result
$content

at line 2567
bool validate($data, $action = vB_Library_Content::ACTION_ADD, $nodeid = false, $nodes = false, $userid = null)

Validates the data according to the action to be taken

Parameters

$data
$action
$nodeid
$nodes
$userid

Return Value

bool

protected addContentInfo($results)

Parameters

$results

postBbcodeParseCleanRawtext(mixed $data)

Cleans the input in the $data array, specifically after any html/wysiwyg -> bbcode parsing.

Parameters

mixed $data Array of fieldname => data pairs, passed by reference.

parseAndStrip($text)

Parameters

$text

protected replaceAndStripBbcode($text, $data = array())

Parameters

$text
$data

array|string getQuotes(array|int $nodeids)

This returns a string with quoted strings in bbcode format.

Parameters

array|int $nodeids

Return Value

array|string either the quote for the node or an array of $nodeid => $quotes for the array of nodes

getQuotesFromNodes(array $nodes)

Helper function to allow getQuotes in the API and Library classes to generate the node list independantly (so that the API can check perms without loading the nodes twice).

Parameters

array $nodes -- array of nodes arrays from getContent (API or Library version) does not accept a single node array

type mergeContent(type $data)

Performs the merge of content and updates the node.

Parameters

type $data

Return Value

type

in vB_Library_Content_Text at line 1178
fixAttachBBCode(mixed $nodeId, array $content = null, array $keysToAttachid = array()) deprecated

deprecated Superceded by replaceAttachBbcodeTempids

DEPRECATED: This needs to remain until the corresponding API function is removed

Used to change temporary id references in the specified node's rawtext to attach nodeids

Parameters

mixed $nodeId nodeid or array of nodeids
array $content (optional) Node content array returned by getFullContent
array $keysToAttachid (optional) array({tempid of attachment} => {attachment's nodeid}) maps temporary-ids (array key) of newly added attachments and corresponding nodeids (array value) of said attachments. While this is optional for historical reasons, it must be provided if any temporary id references in the rawtext need to be replaced.

in vB_Library_Content_Text at line 1208
protected string replaceAttachBbcodeForParseAndStrip(string $rawtext, array $data = array())

Replace [attach], [img] or [img2] bbcode with a plaintext keyword for use in meta description.

Parameters

string $rawtext Text to be replaced.
array $data optional. Data array provided to add() or update() if available. May contain 'attachments' data.

Return Value

string

in vB_Library_Content_Text at line 1334
protected string replaceAttachBbcodeTempids(string $rawtext, array $keysToAttachid)

Replaces the tempids in [attach] bbcodes with the nodeid/attachid for the attachment.

Parameters

string $rawtext The rawtext for the node
array $keysToAttachid Mapping of tempids => nodeid/attachid

Return Value

string The rawtext with the modified [attach] bbcodes

in vB_Library_Content_Text at line 1388
autoPopulatePreviewImage(int $nodeId, array $node = null) deprecated

deprecated Superceded by getPreviewImage

DEPRECATED: This needs to remain until the corresponding API function is removed

Populates the previewimage field for this node. To be called after the node is saved and the attachments added.

Finds the first image in the post text that can be used as a previewimage (uploaded here), or uses the first image attachment.

Parameters

int $nodeId Nodeid
array $node (optional) Node content array returned by getFullContent

in vB_Library_Content_Text at line 1430
protected int|bool getPreviewImage(array $node)

Determines the best attachment to use for the preview image and returns the attachid/nodeid.

Parameters

array $node The node array returned by getFullContent

Return Value

int|bool The nodeid of the attachment that should be used as the preview image, or false for no preview image

at line 125
int addMessageNoFlood(array $data, array $options = array())

Adds a message without triggering the flood check.

Parameters

array $data The data for the message or notification
array $options Array of options to send to the add() function

Return Value

int The nodeid of the created message/notification

at line 154
protected sendEmailNotification(array $data)

Sends the email notication for a private message

Parameters

array $data -- 'msgtype' string => the type of PM: request | message 'about' string => type of request: follow | moderator_to | owner_to 'aboutid' => user to follow (only for request -> follow) 'userid' => id of the message sender? 'username' => username of the message recipient 'email' => address to send to 'folderid' => folder to reference for link to message center.

at line 641
checkCanReceivePM($recipient)

Parameters

$recipient

at line 893
bool moveMessage($nodeid, $newFolderid, $existing)

Moves a message to a different folder

Parameters

$nodeid
$newFolderid
$existing

Return Value

bool did it succeed?

at line 944
mixed getMessage(int $nodeid)

Get a message

Parameters

int $nodeid the nodeid

Return Value

mixed array of data

at line 958
array getRequest(int $nodeid)

Get a single request

Parameters

int $nodeid the nodeid

Return Value

array The node data array for the request

at line 1003
array getMessageTree($nodeid, $exclude, $userid)

Get a message and all replies and sets the message to "read"

Parameters

$nodeid
$exclude
$userid

Return Value

array array of data

at line 1117
mixed listFolders(mixed $suppress = array())

This lists the folders.

Parameters

mixed $suppress array of system folders to be hidden. like self::MESSAGE_FOLDER

Return Value

mixed array of folderid => title

at line 1155
int createMessageFolder($folderName, $userid)

This creates a new message folder. It returns false if the record already exists and the id if it is able to create the folder

Parameters

$folderName
$userid

Return Value

int

at line 1175
toTrashcan(int $nodeid)

Moves a node to the trashcan. Wrapper for deleteMessage()

Parameters

int $nodeid

at line 1203
mixed fetchSummary($userid)

This summarizes messages for specified user

Parameters

$userid

Return Value

mixed
  • array-includes folderId, title, quantity not read.

at line 1341
array listMessages($data, $userid)

This lists messages for current user

Parameters

$data
$userid

Return Value

array
  • list of messages.

at line 1517
Array listNotifications(Array $data, Int $userid) deprecated

deprecated 5.1.6 Only used by unit tests This lists notifications for current user

Parameters

Array $data see vB_Library_Notification::fetchNotificationsForCurrentUser()
Int $userid Not used.

Return Value

Array see vB_Library_Notification::fetchNotificationsForCurrentUser()

at line 1529
mixed listSpecialPrivateMessages(mixed- $data = array())

This lists messages for current user

Parameters

mixed- $data can pass sort direction, type, page, perpage, or folderid.

Return Value

mixed
  • array-includes folderId, title, quantity not read. Also 'page' is array of node records for page 1.

at line 1591
bool deleteMessage($nodeid, $userid = false)

Permanently deletes a message

Parameters

$nodeid
$userid

Return Value

bool did the deletion succeed?

at line 1648
int deleteMessagesForUser(int $userid)

Deletes all pms for a given user

This will mark all "sentto" records for the given user as deleted. In addtion it will mark any PM records for deletion that no longer have any users attached to them. The actual deletion is handled via cron script.

Parameters

int $userid userid

Return Value

int number of sentto items marked for delete (the users pms)

at line 1674
deleteSentMessagesForUser($userid)

Parameters

$userid

at line 1706
array checkFolders(int $userid, bool $skipNonExistentRecipients = false)

This function checks that we have all the folders for the current user, and the set folders are there.

Parameters

int $userid The user id to check folders for
bool $skipNonExistentRecipients If true, do not error when the user isn't valid

Return Value

array Array with the 'result' element, indicating if the folders were loaded, were already loaded, or if the user was skipped.

at line 1793
array validateRequest(int $userid, int $nodeid)

Verifies that the request exists and its valid.

Returns the message if no error is found. Throws vB_Exception_Api if an error is found.

Parameters

int $userid
int $nodeid

Return Value

array
  • message info

at line 1827
array denyRequest(int $nodeid, int $cancelRequestFor)

This function denies a user follow request

Parameters

int $nodeid the nodeid of the request
int $cancelRequestFor (optional) the userid to whom the request was sent

Return Value

array
  • array('result' => resultphrase) if resultphrase is empty, there is nothing useful to say about what happened

at line 1873
bool acceptRequest(int $nodeid)

This function accepts a user follow request or a channel ownership/moderation/membership request

Parameters

int $nodeid the nodeid of the request

Return Value

bool

at line 2001
resetFolders()

Clears the cached folder information

at line 2009
fetchFolders($userid)

returns the cached folder information

Parameters

$userid

at line 2019
setRead($nodeid, $read, $userid, $folderKey = false)

This sets a message to read

Parameters

$nodeid
$read
$userid
$folderKey

at line 2062
unsetFolders($userid)

returns the cached folder information

Parameters

$userid

at line 2072
int checkCanSee(mixed $nodeids)

Checks nodes to ensure that the current user can see them.

Parameters

mixed $nodeids integer or array of integers for id in the primary table

Return Value

int

at line 2121
mixed addMessageInfo(mixed $nodes)

Returns the node content as an associative array

Parameters

mixed $nodes array of content records

Return Value

mixed array of content records with extra "about" information for notifications.

at line 2198
int getPendingPostFolderId()

Get the pending posts folder id

Return Value

int The pending posts folder id from messagefolder.

at line 2215
int getInfractionFolderId()

Get the infraction folder id

Return Value

int The infraction folder id from messagefolder.

at line 2232
int getDeletedItemsFolderId()

Get the deleted_items folder id

Return Value

int The deleted_items folder id from messagefolder.

at line 2249
mixed getChannelRequestTypes()

Returns array of Request message types

Return Value

mixed array of strings *

at line 2258
mixed fetchNotificationTypes()

Return all the valid notification types

Return Value

mixed array of strings

at line 2271
bool undeleteMessage($nodeid, $existing)

Move a message back to user inbox folder

Parameters

$nodeid
$existing

Return Value

bool True if succesfully done.

at line 2285
bool deleteMessages($nodeids)

Delete messages

Parameters

$nodeids

Return Value

bool Indicating if deletion were succesfully done or will throw exception.

at line 2315
protected bool moveUndeleted(int $nodeid, int $newFolderid, int $existing)

Move messages to inbox marking them as undeleted.

Parameters

int $nodeid the node to be moved
int $newFolderid the new parent node.
int $existing existing sent to records.

Return Value

bool did it succeed?

at line 2359
array getFolderFromId($folderid, $userid)

Gets the folder information from a given folderid. The folderid requested should belong to the user who is requesting.

Parameters

$folderid
$userid

Return Value

array The folder information such as folder title, titlephrase and if is custom folder.

at line 2386
buildPmTotals(array|int $userids)

Calculates the number of private messages that a user has in the system Used to limit pm abilities based on overage of this count

Parameters

array|int $userids List of users to rebuild user.pmtotal for

at line 2396
boolean userReceivesNotification($userid, $notificationType)

Checks if userid's notification options for notification type

Parameters

$userid
$notificationType

Return Value

boolean true if user should receive the notificationType

at line 2484
String|Bool convertLegacyNotificationAboutString(String $aboutString)

Translates the legacy notification type string into the new notification typename

Parameters

String $aboutString

Return Value

String|Bool New notification typename, or False if mapping is unknown

at line 2532
String convertNotificationTypeToLegacyAboutString(String $typename)

Translates the legacy notification type string into an array of type information

Parameters

String $typename

Return Value

String Returns the legacy NOTIFICATION_TYPE_X string for the typename. If the mapping is unknown, an empty string is returned.