class vB_Api_Content_Privatemessage extends vB_Api_Content_Text

vB_Api_Content_Privatemessage

Traits

Constants

PARTICIPANTS_PM

PARTICIPANTS_POLL

PARTICIPANTS_CHANNEL

Properties

protected bool $disabled Indicates whether the API was disabled from vB_Api
protected $disableWhiteList
protected $disableFalseReturnOnly
protected string $controller API Controller from vB_Api
protected vB_Database $db Database object. from vB_Api
protected vB_UserContext $usercontext from vB_Api_Content
protected $assertor
protected vB_Api_Node $nodeApi from vB_Api_Content
protected array $options from vB_Api_Content
protected bool $doFloodCheck from vB_Api_Content
protected vB_Library_Content $library from vB_Api_Content
protected $contenttype
protected $tablename
protected $bbcode_parser from vB_Api_Content_Text
protected $textCountChange from vB_Api_Content_Text
protected $showSignature from vB_Api_Content_Text
protected $textRequired from vB_Api_Content_Text
protected $folders
protected $pmChannel
protected $canSee
protected $notificationTypes
protected $bbcodeOptions

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()

Constructor, no external instantiation.

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
int
getTextCountChange()

Returns textCountChange property

integer
add(mixed $data, array $options = array())

Adds a new private message

cleanOptions(array $options)

Clean unallowed options from user request, only cleans 'skipFloodCheck' for now

cleanInput(mixed $data, int|false $nodeid = false)

Cleans the input in the $data array, directly updating $data.

boolean
delete(integer $nodeid)

Permanently deletes a node

static mixed
getContentApi(int $contenttypeid)

Returns a content api of the appropriate type

bool
isPublished(array $data)

Determines if this record is in a published state

bool
update(mixed $nodeid, mixed $data)

Updates a record

getContent($nodeid, $permissions = false)

Alias for @getFullContent

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

Returns the node content as an associative array

cleanPreviewContent(mixed $record)

Takes a node record and removes the data cannot be viewed based on public_preview.

mixed
getBareContent(int $nodeid, array $permissions = false)

Returns the node content, channel routeid and title, and starter route and title, but no permissions or other subsidiary data

array|false
getConversationParent(int $nodeid)

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

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

getBbcodeOptions($nodeid = 0)

Returns an array with bbcode options for PMs

int
getTimeNow()

Gives the current board time- needed to set publishdate.

string
getQuoteText(int $nodeid)

This returns the text to quote a node. Used initially for private messaging.

string
createQuoteText($nodeid, $pageText)

This returns the text to quote a node. Used initially for private messaging.

array
fetchTableName()

Returns the tables used by this content type.

bool
isVisitorMessage(int $nodeid)

Determines whether a specific node is a visitor message

mixed
extractMedia(string $rawtext)

Extracts the video and photo content from text.

bool
verify_limits(array $data)

Checks the "limit" permissions for this content item

checkTextLength(int $minChars, int $maxChars, string $text)

Check that the $text length falls in the minChar/maxChar limits Checks some class properties as well as does a transform on the text to normalize things.

void
checkHtmlstateForComments(array $data, int $nodeid = 0)

Checks 'htmlstate' and disables it if this is a comment

string
getQuotes(mixed $nodeids)

Returns a string with quoted strings in bbcode format.

array
getDataForParse(mixed $nodeIds)

Gets the data the presentation layer needs to have to parse the rawtext.

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

DEPRECATED - This is now handled internally by the library, nothing is called from controllers.

autoPopulatePreviewImage(int $nodeId) deprecated

DEPRECATED - This is now handled internally by the library, nothing is called from controllers.

checkAttachmentPermissions($data, $nodeid = false)

Checks createpermissions.vbforum_attach and forumpermissions.maxattachments to see that user can add attachments under $data['parentid'] and that attachment limit is not exceeded. Throws exceptions meant to prevent node addition/update, so this function should be called before calling Library's add() or update()

bool
canUsePmSystem($userid = null)

Private messaging can be disabled either by pmquota or enablepms

addPMRecipientsByUsernames($pmid, $usernames = array(), $usernamesToIds = array(), $delimiter = ';')

No description

addPMRecipients($pmid, $recipients)

No description

bool
deleteMessage(int $nodeid)

Permanently deletes a message

array
deleteMessagesForUser(int $userid)

Deletes all pms for a given user

array
deleteSentMessagesForUser(int $userid)

Deletes all pms for a given user

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

bool
moveMessage(int $nodeid, int $newFolderid = false)

Moves a message to a different folder

mixed
getMessage(int $nodeid)

Gets a message

array
getRequest(int $nodeid)

Get a single request

mixed
listFolders(mixed $suppress = array())

Lists the folders.

int
createMessageFolder($folderName)

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()

array
fetchSummary()

Returns a summary of messages for current user

array
listMessages($data = array())

Lists messages for current user

Array
listNotifications(mixed- $data = array()) deprecated

Lists notifications for current user

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

Lists messages for current user

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

Lists messages for current user

Array
getFolderMsgCount(int $folderid, int $pageNum = 1, int $perpage = 50, String $about = false, Array $filterParams = false)

Gets the count of undeleted messages in a folder

int
getUnreadInboxCount()

Gets the count of undeleted messages & notifications

array
getHeaderCounts()

Gets the count of undeleted privatemessages, requests, notifications & reports

int
getOpenReportsCount()

Gets the count of open reports

mixed
previewMessages()

Gets the preview for the messages

getReplyText($nodeid)

Returns the text for a "reply" or "forward" message. Not implemented yet

standard
setRead($nodeid, $read = 1)

Sets a message to read

checkFolders(int $userid = false)

Checks that we have all the folders for the current user, and the set folders are there.

array
updateFolderTitle(string $folderName, int $folderid)

Updates the title

deleteFolder(string $folderid)

Deletes a folder and moves its contents to trash

mixed
getForward(mixed $nodeids)

Gets the title and forward

array
validateRequest(int $userid, int $nodeid)

Verifies that the request exists and its valid.

array
denyRequest(int $nodeid, int $cancelRequestFor = 0)

Denies a user follow request

bool
acceptRequest(int $nodeid)

Accepts a user follow request or a channel ownership/moderation/membership request

resetFolders()

Clears the cached folder information

string
getSearchJSON(string $queryText)

Returns a formatted json string appropriate for the search api interface

int
getPendingPostFolderId()

Gets the pending posts folder id

int
getInfractionFolderId()

Gets the infractions folder id

int
getDeletedItemsFolderId()

Gets the deleted_items folder id

bool
undeleteMessage($nodeid)

Moves a message back to user inbox folder

array
deleteMessages($nodeid)

Delete private messages. Once deleted user won't be able to retrieve them again.

array
getFolderInfoFromId(int $folderid)

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

mixed
fetchFolders(int $userid)

Returns the cached folder information

array
fetchParticipants(int $nodeid)

Returns an array of all users participating in a discussion

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 49
protected __construct()

Constructor, no external instantiation.

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()

in vB_Api_Content at line 79
int getTextCountChange()

Returns textCountChange property

Return Value

int

at line 633
integer add(mixed $data, array $options = array())

Adds a new private message

Parameters

mixed $data Array of field => value pairs which define the record.
array $options Array of options for the content being created. Understands skipTransaction, skipFloodCheck, floodchecktime, many subclasses have skipNotification. See subclasses for more info.

Return Value

integer the new nodeid

in vB_Api_Content at line 124
protected cleanOptions(array $options)

Clean unallowed options from user request, only cleans 'skipFloodCheck' for now

Parameters

array $options Array of options, may be passed in from client

in vB_Api_Content_Text at line 624
cleanInput(mixed $data, int|false $nodeid = false)

Cleans the input in the $data array, directly updating $data.

Parameters

mixed $data Array of fieldname => data pairs, passed by reference.
int|false $nodeid Nodeid of the node being edited, false if creating new

in vB_Api_Content_Text at line 58
boolean delete(integer $nodeid)

Permanently deletes a node

Parameters

integer $nodeid The nodeid of the record to be deleted

Return Value

boolean

in vB_Api_Content at line 356
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_Api_Content at line 368
bool isPublished(array $data)

Determines if this record is in a published state

Parameters

array $data The standard array of data sent to the add() method

Return Value

bool

in vB_Api_Content_Text at line 193
bool update(mixed $nodeid, mixed $data)

Updates a record

Parameters

mixed $nodeid array of nodeids
mixed $data array of permissions that should be checked.

Return Value

bool

in vB_Api_Content at line 428
getContent($nodeid, $permissions = false)

Alias for @getFullContent

Parameters

$nodeid
$permissions

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

Returns the node content as an associative array

Parameters

integer $nodeid The node id
array $permissions Permissions

Return Value

array The standard array of node data

in vB_Api_Content at line 468
cleanPreviewContent(mixed $record)

Takes a node record and removes the data cannot be viewed based on public_preview.

It's called from the search Api, which avoids using the content APIs

Parameters

mixed $record The node record, normally from getNodeFullContent, by reference

in vB_Api_Content at line 541
mixed getBareContent(int $nodeid, array $permissions = false)

Returns the node content, channel routeid and title, and starter route and title, but no permissions or other subsidiary data

Parameters

int $nodeid The Node ID
array $permissions Permissions

Return Value

mixed

in vB_Api_Content at line 581
array|false getConversationParent(int $nodeid)

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

Parameters

int $nodeid

Return Value

array|false The starter node array. False when the node lookup fails

Exceptions

vB_Exception_Api('no_permission')

in vB_Api_Content at line 612
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

at line 1289
getBbcodeOptions($nodeid = 0)

Returns an array with bbcode options for PMs

Parameters

$nodeid

in vB_Api_Content at line 633
int getTimeNow()

Gives the current board time- needed to set publishdate.

Return Value

int

in vB_Api_Content at line 645
string getQuoteText(int $nodeid)

This returns the text to quote a node. Used initially for private messaging.

Parameters

int $nodeid The nodeid of the quoted item

Return Value

string Quote text

in vB_Api_Content at line 659
string createQuoteText($nodeid, $pageText)

This returns the text to quote a node. Used initially for private messaging.

Parameters

$nodeid
$pageText

Return Value

string Quote text.

in vB_Api_Content at line 671
array fetchTableName()

Returns the tables used by this content type.

Return Value

array Array of table names

in vB_Api_Content at line 684
bool isVisitorMessage(int $nodeid)

Determines whether a specific node is a visitor message

Parameters

int $nodeid NodeID

Return Value

bool

in vB_Api_Content at line 696
mixed extractMedia(string $rawtext)

Extracts the video and photo content from text.

Parameters

string $rawtext

Return Value

mixed Array of "photo", "video". Each is an array of images.

in vB_Api_Content at line 713
protected bool verify_limits(array $data)

Checks the "limit" permissions for this content item

Parameters

array $data Info about the content that needs to be added

Return Value

bool Either true if all the tests passed or thrown exception

in vB_Api_Content_Text at line 308
protected checkTextLength(int $minChars, int $maxChars, string $text)

Check that the $text length falls in the minChar/maxChar limits Checks some class properties as well as does a transform on the text to normalize things.

Throws an exception if validation fails.

Parameters

int $minChars -- check if $this->textRequired is true
int $maxChars -- unlimited if 0
string $text

in vB_Api_Content_Text at line 332
protected void checkHtmlstateForComments(array $data, int $nodeid = 0)

Checks 'htmlstate' and disables it if this is a comment

Parameters

array $data (reference) The node data array
int $nodeid (optional) The node ID. This should be used when updating and the parent ID is not passed in the data array

Return Value

void This function modifies the passed $data array.

in vB_Api_Content_Text at line 402
string getQuotes(mixed $nodeids)

Returns a string with quoted strings in bbcode format.

Parameters

mixed $nodeids array of integers

Return Value

string

in vB_Api_Content_Text at line 427
array getDataForParse(mixed $nodeIds)

Gets the data the presentation layer needs to have to parse the rawtext.

Parameters

mixed $nodeIds nodeId or array of nodeIds

Return Value

array Array of node information for parsing the content. Each item indexed by the nodeid and contains: 'bbcodeoptions', 'rawtext', 'previewtext', 'attachments', 'title' 'channelid', 'htmlstate', 'disable_bbcode', 'avatar_userids'

in vB_Api_Content_Text at line 735
mixed fixAttachBBCode(mixed $nodeId, array $keysToAttachid = array()) deprecated

deprecated Superceded by replaceAttachBbcodeTempids in the text library.

DEPRECATED - This is now handled internally by the library, nothing is called from controllers.

This was used by the createcontent controller's handleAttachmentUploads() to fix temporary id references in the specified node's rawtext to nodeids

Parameters

mixed $nodeId nodeid or array of nodeids
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.

Return Value

mixed array includes bbcodeoptions, attachments, and rawtext

in vB_Api_Content_Text at line 759
autoPopulatePreviewImage(int $nodeId) deprecated

deprecated Superceded by getPreviewImage in the text library.

DEPRECATED - This is now handled internally by the library, nothing is called from controllers.

NOTE: This is still used by some upgrade steps, so we can't remove it completely at this time.

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

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

Parameters

int $nodeId Nodeid

in vB_Api_Content_Text at line 793
protected checkAttachmentPermissions($data, $nodeid = false)

Checks createpermissions.vbforum_attach and forumpermissions.maxattachments to see that user can add attachments under $data['parentid'] and that attachment limit is not exceeded. Throws exceptions meant to prevent node addition/update, so this function should be called before calling Library's add() or update()

The createpermissions.vbforum_attach will be checked if there is any change in attachments. However, the attachment limit forumpermissions.maxattachments will only be checked if there is a net gain of attachments. If there is absolutely no change to attachments (signified by an empty $data['attachments'] and empty $data['removeattachments']), no permission will be checked as we do not want to prevent a recent change in attachment-related channel permissions (e.g. attachment limit being decreased or the createpermission being unset since post creation) to prevent a text-only update.

Parameters

$data
$nodeid

Exceptions

vB_Exception_Api('invalid_parentid') if required 'parentid' is not found in $data
vB_Exception_Api('no_create_permissions_attach') if user lacks createpermissions.vbforum_attach channel permission.
vB_Exception_Api('max_attachments_exceeded_x') if attachment limit check failed per above notes.

at line 67
bool canUsePmSystem($userid = null)

Private messaging can be disabled either by pmquota or enablepms

Parameters

$userid

Return Value

bool True if the current user can use the PM system, false otherwise

at line 100
addPMRecipientsByUsernames($pmid, $usernames = array(), $usernamesToIds = array(), $delimiter = ';')

Parameters

$pmid
$usernames
$usernamesToIds
$delimiter

at line 259
addPMRecipients($pmid, $recipients)

Parameters

$pmid
$recipients

at line 782
bool deleteMessage(int $nodeid)

Permanently deletes a message

Parameters

int $nodeid nodeid of the entry to be deleted.

Return Value

bool did the deletion succeed?

at line 819
array 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.

The requested user must much the current user or the current use have the 'canadminusers' permission

Parameters

int $userid

Return Value

array 'deleted' int -- number of items marked for delete (for the user, the pm itself might be referenced by another user and therefore still around)

Exceptions

vB_Exception_Api -- invalid_data_w_x_y_z when userid is not valid -- not_logged_no_permission user is not an admin and does not have permission to use pm system

at line 869
array deleteSentMessagesForUser(int $userid)

Deletes all pms for a given user

This will mark all "sentto" records for PM nodes sent by 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.

The the current user must have the 'canadminusers' permission. (This deletes things from other people's inboxes so we don't want to allow normal users to use it)

Parameters

int $userid

Return Value

array 'deleted' int -- number of items marked for delete (for the user, the pm itself might be referenced by another user and therefore still around)

Exceptions

vB_Exception_Api -- invalid_data_w_x_y_z when userid is not valid

at line 889
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 912
bool moveMessage(int $nodeid, int $newFolderid = false)

Moves a message to a different folder

Parameters

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

Return Value

bool did it succeed?

at line 990
mixed getMessage(int $nodeid)

Gets a message

Parameters

int $nodeid The Node ID

Return Value

mixed Array of data

at line 1028
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 1072
mixed listFolders(mixed $suppress = array())

Lists the folders.

Parameters

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

Return Value

mixed array of folderid => title

at line 1082
int createMessageFolder($folderName)

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

Return Value

int

at line 1103
toTrashcan(int $nodeid)

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

Parameters

int $nodeid

at line 1123
array fetchSummary()

Returns a summary of messages for current user

Return Value

array Array of information including: folderId, title, quantity not read.

at line 1147
array listMessages($data = array())

Lists messages for current user

Parameters

$data

Return Value

array
  • list of messages.

at line 1167
Array listNotifications(mixed- $data = array()) deprecated

deprecated 5.1.6 Only used by unit tests

Lists notifications for current user

Parameters

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

Return Value

Array see vB_Library_Notification::fetchNotificationsforCurrentUser()

at line 1190
protected mixed listSpecialPrivateMessages(mixed- $data = array())

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 1208
mixed listRequests(mixed- $data = array())

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 1317
Array getFolderMsgCount(int $folderid, int $pageNum = 1, int $perpage = 50, String $about = false, Array $filterParams = false)

Gets the count of undeleted messages in a folder

Parameters

int $folderid the folderid to search
int $pageNum
int $perpage
String $about Optional "about" string
Array $filterParams Optional filter parameters, only used for notifications. See vB_Library_Notification::fetchNotificationsForCurrentUser() - 'sortDir' - 'perpage' - 'page' - 'showdetail' - 'about'

Return Value

Array the count & page data, including: 'count', 'pages' (total pages), 'pagenum' (selected page #), 'nextpage', 'prevpage'

at line 1412
int getUnreadInboxCount()

Gets the count of undeleted messages & notifications

Return Value

int the count

at line 1458
array getHeaderCounts()

Gets the count of undeleted privatemessages, requests, notifications & reports

Return Value

array int 'messages' private messages int 'requests' int 'notifications' int 'pending_posts' int 'reports' bool 'canviewreports' if the "reports" should be displayed. int 'nonpms_sum' sum of the int counts minus 'messages' count int 'folderid_messages'

at line 1525
int getOpenReportsCount()

Gets the count of open reports

Return Value

int the count of open reports

at line 1544
mixed previewMessages()

Gets the preview for the messages

Return Value

mixed array of record-up to five each messages, then requests, then notifications

at line 1878
getReplyText($nodeid)

Returns the text for a "reply" or "forward" message. Not implemented yet

Parameters

$nodeid

at line 1894
standard setRead($nodeid, $read = 1)

Sets a message to read

Parameters

$nodeid
$read

Return Value

standard success array

at line 1910
checkFolders(int $userid = false)

Checks that we have all the folders for the current user, and the set folders are there.

Parameters

int $userid User ID of the current user

at line 1930
array updateFolderTitle(string $folderName, int $folderid)

Updates the title

Parameters

string $folderName The folder name
int $folderid The folder ID

Return Value

array The array of folder information for this folder.

at line 1976
deleteFolder(string $folderid)

Deletes a folder and moves its contents to trash

Parameters

string $folderid The new folder title.

at line 2033
mixed getForward(mixed $nodeids)

Gets the title and forward

Parameters

mixed $nodeids will accept an array, but normall a comma-delimited string

Return Value

mixed array of first (single db record), messages- nodeid=> array(title, recipents(string), to (array of names), pagetext, date)

at line 2151
protected 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 2168
array denyRequest(int $nodeid, int $cancelRequestFor = 0)

Denies a user follow request

Parameters

int $nodeid the nodeid of the request
int $cancelRequestFor (optional) the userid to whom the request was sent, if not given, will use current logged in user. If it is not the currently logged in user then will return a "no_permission" error. This may be extended in the future to allow admins to denyRequests on behalf of other users.

Return Value

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

at line 2193
bool acceptRequest(int $nodeid)

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 2201
resetFolders()

Clears the cached folder information

at line 2213
string getSearchJSON(string $queryText)

Returns a formatted json string appropriate for the search api interface

Parameters

string $queryText the search query

Return Value

string the json string

at line 2225
int getPendingPostFolderId()

Gets the pending posts folder id

Return Value

int The pending posts folder id from messagefolder.

at line 2235
int getInfractionFolderId()

Gets the infractions folder id

Return Value

int The infractions folder id from messagefolder.

at line 2245
int getDeletedItemsFolderId()

Gets the deleted_items folder id

Return Value

int The deleted_items folder id from messagefolder.

at line 2258
bool undeleteMessage($nodeid)

Moves a message back to user inbox folder

Parameters

$nodeid

Return Value

bool True if succesfully done.

at line 2303
array deleteMessages($nodeid)

Delete private messages. Once deleted user won't be able to retrieve them again.

Parameters

$nodeid

Return Value

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

at line 2333
array getFolderInfoFromId(int $folderid)

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

Parameters

int $folderid The folderid to fetch information for.

Return Value

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

at line 2365
mixed fetchFolders(int $userid)

Returns the cached folder information

Parameters

int $userid Userid we are fetching folders for.

Return Value

mixed Array containing user folders info.

at line 2388
array fetchParticipants(int $nodeid)

Returns an array of all users participating in a discussion

Parameters

int $nodeid the nodeid of the discussion

Return Value

array of user information * following -- is the participant a follower of the current user (may be NULL) * userid -- ID of the participant * username -- Name of the participant * avatarurl -- Url for the participant's avatar * starter -- ID of the starter for $nodeid