vBulletin 5.6.5 API

vB_Api_Content_Privatemessage extends vB_Api_Content_Text
in package

vB_Api_Content_Privatemessage

Tags
author

ebrown

copyright

Copyright (c) 2011

version

$Id: privatemessage.php 105612 2020-07-17 23:00:44Z ksours $

access

public

Table of Contents

PARTICIPANTS_CHANNEL  = 'Channel'
PARTICIPANTS_PM  = 'PrivateMessage'
PARTICIPANTS_POLL  = 'Poll'
$assertor  : mixed
$bbcode_parser  : mixed
$bbcodeOptions  : mixed
$canSee  : mixed
$contenttype  : mixed
$controller  : string
API Controller
$db  : vB_Database
Database object.
$disabled  : bool
Indicates whether the API was disabled
$disableFalseReturnOnly  : mixed
$disableWhiteList  : mixed
$doFloodCheck  : bool
$folders  : mixed
$library  : vB_Library_Content
$nodeApi  : vB_Api_Node
$notificationTypes  : mixed
$options  : array<string|int, mixed>
$pmChannel  : mixed
$showSignature  : mixed
$tablename  : mixed
$textRequired  : mixed
$usercontext  : vB_UserContext
$instances  : mixed
$instancesRaw  : array<string|int, mixed>
We want API subclasses to access the instances only through getters
$vb4_input_mappings  : mixed
$wrappers  : mixed
__serialize()  : mixed
__sleep()  : mixed
__unserialize()  : mixed
__wakeup()  : mixed
acceptRequest()  : bool
Accepts a user follow request or a channel ownership/moderation/membership request
add()  : int
Adds a new private message
addPMRecipients()  : mixed
addPMRecipientsByUsernames()  : mixed
autoPopulatePreviewImage()  : mixed
DEPRECATED - This is now handled internally by the library, nothing is called from controllers.
buildPmTotals()  : mixed
Calculates the number of private messages that a user has in the system Used to limit pm abilities based on overage of this count
callNamed()  : The
Call the given api function by name with a named arguments list.
canUsePmSystem()  : bool
Private messaging can be disabled either by pmquota or enablepms
checkApiState()  : mixed
This method checks whether the API method is enabled.
checkFolders()  : mixed
Checks that we have all the folders for the current user, and the set folders are there.
cleanInput()  : mixed
Cleans the input in the $data array, directly updating $data.
cleanPreviewContent()  : mixed
Takes a node record and removes the data cannot be viewed based on public_preview.
clearCache()  : mixed
Clears all previously loaded API objects.
createMessageFolder()  : int
Creates a new message folder. It returns false if the record already exists and the id if it is able to create the folder
createQuoteText()  : string
This returns the text to quote a node. Used initially for private messaging.
delete()  : bool
Permanently deletes a node
deleteFolder()  : mixed
Deletes a folder and moves its contents to trash
deleteMessage()  : bool
Permanently deletes a message
deleteMessages()  : array<string|int, mixed>
Delete private messages. Once deleted user won't be able to retrieve them again.
deleteMessagesForUser()  : array<string|int, mixed>
Deletes all pms for a given user
deleteSentMessagesForUser()  : array<string|int, mixed>
Deletes all pms for a given user
denyRequest()  : array<string|int, mixed>
Denies a user follow request
extractMedia()  : mixed
Extracts the video and photo content from text.
fetchFolders()  : mixed
Returns the cached folder information
fetchParticipants()  : array<string|int, mixed>
Returns an array of all users participating in a discussion
fetchSummary()  : array<string|int, mixed>
Returns a summary of messages for current user
fetchTableName()  : array<string|int, mixed>
Returns the tables used by this content type.
fixAttachBBCode()  : mixed
DEPRECATED - This is now handled internally by the library, nothing is called from controllers.
getApiClassName()  : mixed
getBareContent()  : mixed
Returns the node content, channel routeid and title, and starter route and title, but no permissions or other subsidiary data
getBbcodeOptions()  : array<string|int, mixed>
Returns an array with bbcode options for PMs
getContent()  : mixed
Alias for @getFullContent
getContentApi()  : mixed
Returns a content api of the appropriate type
getConversationParent()  : array<string|int, mixed>|false
Gets the conversation starter for a node. If the node is a channel it returns the channel array.
getDataForParse()  : array<string|int, mixed>
Gets the data the presentation layer needs to have to parse the rawtext.
getDeletedItemsFolderId()  : int
Gets the deleted_items folder id
getFolderInfoFromId()  : array<string|int, mixed>
Gets the folder information from a given folderid. The folderid requested should belong to the user who is requesting.
getFolderMsgCount()  : array<string|int, mixed>
Gets the count of undeleted messages in a folder
getForward()  : mixed
Gets the title and forward
getFullContent()  : array<string|int, mixed>
Returns the node content as an associative array
getHeaderCounts()  : array<string|int, mixed>
Gets the count of unread messages, requests, & notifications for regular users, and also pending posts & reports for admins and moderators with access.
getInfractionFolderId()  : int
Gets the infractions folder id
getMessage()  : mixed
Gets a message
getOpenReportsCount()  : int
Gets the count of open reports
getPendingPostFolderId()  : int
Gets the pending posts folder id
getQuotes()  : string
Returns a string with quoted strings in bbcode format.
getQuoteText()  : string
This returns the text to quote a node. Used initially for private messaging.
getReplyText()  : mixed
Returns the text for a "reply" or "forward" message. Not implemented yet
getRequest()  : array<string|int, mixed>
Get a single request
getSearchJSON()  : string
Returns a formatted json string appropriate for the search api interface
getTextCountChange()  : int
Returns textCountChange property
getTimeNow()  : int
Gives the current board time- needed to set publishdate.
getUnreadInboxCount()  : int
Gets the count of undeleted messages & notifications
instance()  : vB_Api
Returns an instance of the API object which translates exceptions to an array Use this method for API clients.
instanceInternal()  : vB_Api
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
isPublished()  : bool
Determines if this record is in a published state
isVisitorMessage()  : bool
Determines whether a specific node is a visitor message
listFolders()  : mixed
Lists the folders.
listMessages()  : array<string|int, mixed>
Lists messages for current user
listNotifications()  : array<string|int, mixed>
Lists notifications for current user
listRequests()  : mixed
Lists messages for current user
map_vb4_input_to_vb5()  : string
Returns vb5 api method name.
map_vb5_errors_to_vb4()  : mixed
Alters the error array in any way necessary to interface correctly with vb4.
map_vb5_output_to_vb4()  : mixed
Alters the output array in any way necessary to interface correctly with vb4.
moveMessage()  : bool
Moves a message to a different folder
previewMessages()  : mixed
Gets the preview for the messages
resetFolders()  : mixed
Clears the cached folder information
setRead()  : standard
Sets a message to read
toTrashcan()  : mixed
Moves a node to the trashcan. Wrapper for deleteMessage()
undeleteMessage()  : bool
Moves a message back to user inbox folder
update()  : bool
Updates a record
updateFolderTitle()  : array<string|int, mixed>
Updates the title
__construct()  : mixed
Constructor, no external instantiation.
checkAttachmentPermissions()  : mixed
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()
checkHasAdminPermission()  : none
Determines if the calling user has the given admin permission, and if not throws an exception
checkHasPermission()  : none
Determines if the calling user has the given bitfield permission, and if not, throws a 'no_permission' exception.
checkHtmlstateForComments()  : void
Checks 'htmlstate' and disables it if this is a comment
checkIsLoggedIn()  : mixed
Determines if the calling user has the given admin permission, and if not throws an exception
checkTextLength()  : mixed
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.
cleanOptions()  : mixed
Clean unallowed options from user request, only cleans 'skipFloodCheck' for now
getApiClass()  : mixed
getApiClassNameInternal()  : mixed
hasAdminPermission()  : bool
Determines if the calling user has the given admin permission
inDebugMode()  : mixed
isDisableFalseReturnOnly()  : bool
Checks if method returns false response only when API is disabled.
isWhiteListed()  : bool
Checks if method is white listed when API is disabled.
listSpecialPrivateMessages()  : mixed
Lists messages for current user
setController()  : mixed
Set controller
validateRequest()  : array<string|int, mixed>
Verifies that the request exists and its valid.
verify_limits()  : bool
Checks the "limit" permissions for this content item
cms_vb4_to_vb5_method_mapping()  : mixed
default_vb4_to_vb5_method_mapping()  : mixed
getCharLimits()  : array<string|int, mixed>
Gets the char limits for a node's text
getFolderRouteInfo()  : mixed
hasAdminPermissionInternal()  : mixed
Internal function to power the previous cover functions
remove_nulls()  : mixed
wrapLoggerIfNeeded()  : mixed
Wrap the api object with the log wrapper class if needed.

Constants

PARTICIPANTS_CHANNEL

public mixed PARTICIPANTS_CHANNEL = 'Channel'

Properties

$bbcode_parser

protected mixed $bbcode_parser = alse

$contenttype

protected mixed $contenttype = 'vBForum_PrivateMessage'

$controller

API Controller

protected string $controller

$disabled

Indicates whether the API was disabled

protected bool $disabled = alse

$disableFalseReturnOnly

protected mixed $disableFalseReturnOnly = array('getHeaderCounts')

$disableWhiteList

protected mixed $disableWhiteList = array('getUnreadInboxCount', 'canUsePmSystem', 'fetchSummary')

$doFloodCheck

protected bool $doFloodCheck = rue

$options

protected array<string|int, mixed> $options

$showSignature

protected mixed $showSignature = rue

$tablename

protected mixed $tablename = array('text', 'privatemessage')

$textRequired

protected mixed $textRequired = rue

$instances

private static mixed $instances

$instancesRaw

We want API subclasses to access the instances only through getters

private static array<string|int, mixed> $instancesRaw

$vb4_input_mappings

private static mixed $vb4_input_mappings = array( 'blog.post_comment' => array('method' => 'vb4_blog.post_comment'), 'blog.post_postcomment' => array('method' => 'vb4_blog.post_postcomment'), 'blog.post_updateblog' => array('method' => 'vb4_blog.post_updateblog'), 'blog.post_newblog' => array('method' => 'vb4_blog.post_newblog'), 'blog.post_editblog' => array('method' => 'vb4_blog.post_editblog'), 'blog_list' => array('method' => 'vb4_blog.bloglist'), 'api_init' => array('method' => 'api.init'), 'api_cmssectionlist' => array('method' => 'Vb4_Cms.sectionlist'), 'api_cmscategorylist' => array('method' => 'Vb4_Cms.categorylist'), /* // These can no longer be mapped directly to vB_Api_User::login/logout // due to additional processing of devicetoken that may be required // for mapi calls. 'login_login' => array( 'method' => 'user.login', 'request_mappings' => array( 'vb_login_username' => 'username', 'vb_login_password' => 'password', 'vb_login_md5password' => 'md5password', 'vb_login_md5password_utf' => 'md5passwordutf' ) ), 'login_logout' => array( 'method' => 'user.logout' ), */ 'get_vbfromfacebook' => array('method' => 'vb4_facebook.getVbfromfacebook'), )

$wrappers

private static mixed $wrappers

Methods

__serialize()

public __serialize() : mixed
Return values
mixed

__sleep()

public __sleep() : mixed
Return values
mixed

__unserialize()

public __unserialize(mixed $serialized) : mixed
Parameters
$serialized : mixed
Return values
mixed

__wakeup()

public __wakeup() : mixed
Return values
mixed

acceptRequest()

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

public acceptRequest(mixed $nodeid) : bool
Parameters
$nodeid : mixed
Return values
bool

add()

Adds a new private message

public add(mixed $data[, mixed $options = array() ]) : int
Parameters
$data : mixed

-- Array of field => value pairs which define the record.

$options : mixed = array()

-- Understands skipTransaction, skipFloodCheck, floodchecktime, skipDupCheck, skipNotification, nl2br, autoparselinks.

  • nl2br: if TRUE, all \n will be converted to
    so that it's not removed by the html parser (e.g. comments).
  • wysiwyg: if true convert html to bbcode. Defaults to true if not given.
Return values
int

the new nodeid.

addPMRecipients()

public addPMRecipients(mixed $pmid, mixed $recipients) : mixed
Parameters
$pmid : mixed
$recipients : mixed
Return values
mixed

addPMRecipientsByUsernames()

public addPMRecipientsByUsernames(mixed $pmid[, mixed $usernames = array() ][, mixed $usernamesToIds = array() ][, mixed $delimiter = ';' ]) : mixed
Parameters
$pmid : mixed
$usernames : mixed = array()
$usernamesToIds : mixed = array()
$delimiter : mixed = ';'
Return values
mixed

autoPopulatePreviewImage()

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

public autoPopulatePreviewImage(mixed $nodeId) : mixed

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
$nodeId : mixed
Tags
deprecated

Superceded by getPreviewImage in the text library.

Return values
mixed

buildPmTotals()

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

public buildPmTotals(mixed $userids) : mixed
Parameters
$userids : mixed
Return values
mixed

callNamed()

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

public callNamed() : The

Used primarily to translate REST requests into API calls.

Return values
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.

canUsePmSystem()

Private messaging can be disabled either by pmquota or enablepms

public canUsePmSystem([mixed $userid = null ]) : bool
Parameters
$userid : mixed = null
Return values
bool

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

checkApiState()

This method checks whether the API method is enabled.

public checkApiState(mixed $method) : mixed

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

Parameters
$method : mixed
Return values
mixed

checkFolders()

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

public checkFolders([mixed $userid = false ]) : mixed
Parameters
$userid : mixed = false
Return values
mixed

cleanInput()

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

public cleanInput(mixed $data[, mixed $nodeid = false ]) : mixed
Parameters
$data : mixed
$nodeid : mixed = false
Return values
mixed

cleanPreviewContent()

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

public cleanPreviewContent(mixed $record) : mixed

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

Parameters
$record : mixed
Return values
mixed

clearCache()

Clears all previously loaded API objects.

public static clearCache() : mixed

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

Return values
mixed

createMessageFolder()

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

public createMessageFolder(mixed $folderName) : int
Parameters
$folderName : mixed
Return values
int

createQuoteText()

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

public createQuoteText(mixed $nodeid, mixed $pageText) : string
Parameters
$nodeid : mixed
$pageText : mixed
Return values
string

Quote text.

delete()

Permanently deletes a node

public delete(mixed $nodeid) : bool
Parameters
$nodeid : mixed
Return values
bool

deleteFolder()

Deletes a folder and moves its contents to trash

public deleteFolder(mixed $folderid) : mixed
Parameters
$folderid : mixed
Return values
mixed

deleteMessage()

Permanently deletes a message

public deleteMessage(mixed $nodeid) : bool
Parameters
$nodeid : mixed
Return values
bool

did the deletion succeed?

deleteMessages()

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

public deleteMessages(mixed $nodeid) : array<string|int, mixed>
Parameters
$nodeid : mixed
Tags
params

mixed Array or comma separated nodeids from messages to delete.

Return values
array<string|int, mixed>

Whether delete action succeeded or not. keys -- success

deleteMessagesForUser()

Deletes all pms for a given user

public deleteMessagesForUser(int $userid) : array<string|int, mixed>

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
$userid : int
Tags
throws
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

Return values
array<string|int, mixed>

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

deleteSentMessagesForUser()

Deletes all pms for a given user

public deleteSentMessagesForUser(int $userid) : array<string|int, mixed>

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
$userid : int
Tags
throws
vB_Exception_Api

-- invalid_data_w_x_y_z when userid is not valid

Return values
array<string|int, mixed>

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

denyRequest()

Denies a user follow request

public denyRequest(mixed $nodeid, mixed $cancelRequestFor) : array<string|int, mixed>
Parameters
$nodeid : mixed
$cancelRequestFor : mixed
Return values
array<string|int, mixed>
  • array('result' => resultphrase) if resultphrase is empty, there is nothing useful to say about what happened

extractMedia()

Extracts the video and photo content from text.

public extractMedia(mixed $rawtext) : mixed
Parameters
$rawtext : mixed
Return values
mixed

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

fetchFolders()

Returns the cached folder information

public fetchFolders(mixed $userid) : mixed
Parameters
$userid : mixed
Return values
mixed

Array containing user folders info.

fetchParticipants()

Returns an array of all users participating in a discussion

public fetchParticipants(mixed $nodeid) : array<string|int, mixed>
Parameters
$nodeid : mixed
Return values
array<string|int, mixed>

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

fetchSummary()

Returns a summary of messages for current user

public fetchSummary() : array<string|int, mixed>
Return values
array<string|int, mixed>

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

fetchTableName()

Returns the tables used by this content type.

public fetchTableName() : array<string|int, mixed>
Return values
array<string|int, mixed>

Array of table names

fixAttachBBCode()

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

public fixAttachBBCode(mixed $nodeId[, array<string|int, mixed> $keysToAttachid = array() ]) : mixed

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

Parameters
$nodeId : mixed

nodeid or array of nodeids

$keysToAttachid : array<string|int, mixed> = array()

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

Tags
deprecated

Superceded by replaceAttachBbcodeTempids in the text library.

Return values
mixed

array includes bbcodeoptions, attachments, and rawtext

getApiClassName()

public static getApiClassName(mixed $controller) : mixed
Parameters
$controller : mixed
Return values
mixed

getBareContent()

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

public getBareContent(mixed $nodeid[, mixed $permissions = false ]) : mixed
Parameters
$nodeid : mixed
$permissions : mixed = false
Return values
mixed

getBbcodeOptions()

Returns an array with bbcode options for PMs

public getBbcodeOptions(mixed $nodeid) : array<string|int, mixed>
Parameters
$nodeid : mixed
Return values
array<string|int, mixed>

Options

getContent()

Alias for @getFullContent

public getContent(mixed $nodeid[, mixed $permissions = false ]) : mixed
Parameters
$nodeid : mixed
$permissions : mixed = false
Return values
mixed

getContentApi()

Returns a content api of the appropriate type

public static getContentApi(mixed $contenttypeid) : mixed
Parameters
$contenttypeid : mixed
Return values
mixed

Content api object

getConversationParent()

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

public getConversationParent(int $nodeid) : array<string|int, mixed>|false
Parameters
$nodeid : int
Tags
throws

vB_Exception_Api('no_permission')

Return values
array<string|int, mixed>|false

The starter node array. False when the node lookup fails

getDataForParse()

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

public getDataForParse(mixed $nodeIds) : array<string|int, mixed>
Parameters
$nodeIds : mixed
Return values
array<string|int, mixed>

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'

getDeletedItemsFolderId()

Gets the deleted_items folder id

public getDeletedItemsFolderId() : int
Return values
int

The deleted_items folder id from messagefolder.

getFolderInfoFromId()

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

public getFolderInfoFromId(mixed $folderid) : array<string|int, mixed>
Parameters
$folderid : mixed
Return values
array<string|int, mixed>

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

getFolderMsgCount()

Gets the count of undeleted messages in a folder

public getFolderMsgCount(int $folderid[, int $pageNum = 1 ][, int $perpage = 50 ][, string $about = false ][, array<string|int, mixed> $filterParams = false ]) : array<string|int, mixed>
Parameters
$folderid : int

the folderid to search

$pageNum : int = 1
$perpage : int = 50
$about : string = false

Optional "about" string

$filterParams : array<string|int, mixed> = false

Optional filter parameters, only used for notifications. See vB_Library_Notification::fetchNotificationsForCurrentUser()

  • 'sortDir'
  • 'perpage'
  • 'page'
  • 'showdetail'
  • 'about'
Return values
array<string|int, mixed>

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

getForward()

Gets the title and forward

public getForward(mixed $nodeids) : mixed
Parameters
$nodeids : mixed
Return values
mixed

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

getFullContent()

Returns the node content as an associative array

public getFullContent(int $nodeid[, mixed $permissions = false ]) : array<string|int, mixed>
Parameters
$nodeid : int
$permissions : mixed = false
Return values
array<string|int, mixed>

getHeaderCounts()

Gets the count of unread messages, requests, & notifications for regular users, and also pending posts & reports for admins and moderators with access.

public getHeaderCounts() : array<string|int, mixed>
Return values
array<string|int, mixed>

with keys 'title', 'count', 'details' where keys are: 'titlephrase' : string phrase title for header bar 'totalcount' : int total count for header bar

'details' : array subdivisions of the total count with keys 'messages', 'requests', 'your_notifications', and possibly: 'pending_posts', 'reports' where each key points to an array of 'titlephrase' => string phrase title for this folder 'count' => int unread count for this folder 'routeinfo' => array routeinfo for generating links 'messages' : int pm counts only 'folderid_messages' : int folderid of messages folder.

getInfractionFolderId()

Gets the infractions folder id

public getInfractionFolderId() : int
Return values
int

The infractions folder id from messagefolder.

getMessage()

Gets a message

public getMessage(mixed $nodeid) : mixed
Parameters
$nodeid : mixed
Return values
mixed

Array of data

getOpenReportsCount()

Gets the count of open reports

public getOpenReportsCount() : int
Return values
int

the count of open reports

getPendingPostFolderId()

Gets the pending posts folder id

public getPendingPostFolderId() : int
Return values
int

The pending posts folder id from messagefolder.

getQuotes()

Returns a string with quoted strings in bbcode format.

public getQuotes(mixed $nodeids) : string
Parameters
$nodeids : mixed
Return values
string

getQuoteText()

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

public getQuoteText(mixed $nodeid) : string
Parameters
$nodeid : mixed
Return values
string

Quote text

getReplyText()

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

public getReplyText(mixed $nodeid) : mixed
Parameters
$nodeid : mixed
Return values
mixed

getRequest()

Get a single request

public getRequest(mixed $nodeid) : array<string|int, mixed>
Parameters
$nodeid : mixed
Return values
array<string|int, mixed>

The node data array for the request

getSearchJSON()

Returns a formatted json string appropriate for the search api interface

public getSearchJSON(mixed $queryText) : string
Parameters
$queryText : mixed
Return values
string

the json string

getTextCountChange()

Returns textCountChange property

public getTextCountChange() : int
Return values
int

getTimeNow()

Gives the current board time- needed to set publishdate.

public getTimeNow() : int
Return values
int

getUnreadInboxCount()

Gets the count of undeleted messages & notifications

public getUnreadInboxCount() : int
Return values
int

the count

instance()

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

public static instance(string $controller[, bool $refresh_cache = false ]) : vB_Api
Parameters
$controller : string

-- name of the API controller to load

$refresh_cache : bool = false

-- true if we want to force the cache to update with a new api object primarily intended for testing

Return values
vB_Api

instanceInternal()

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

public static instanceInternal(string $controller[, bool $refresh_cache = false ]) : vB_Api
Parameters
$controller : string

-- name of the API controller to load

$refresh_cache : bool = false

-- true if we want to force the cache to update with a new api object primarily intended for testing

Return values
vB_Api

isPublished()

Determines if this record is in a published state

public isPublished(mixed $data) : bool
Parameters
$data : mixed
Return values
bool

isVisitorMessage()

Determines whether a specific node is a visitor message

public isVisitorMessage(mixed $nodeid) : bool
Parameters
$nodeid : mixed
Return values
bool

listFolders()

Lists the folders.

public listFolders([mixed $suppress = array() ]) : mixed
Parameters
$suppress : mixed = array()
Return values
mixed

array of folderid => title

listMessages()

Lists messages for current user

public listMessages([array<string|int, mixed> $data = array() ]) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed> = array()

'sortDir' 'pageNum' 'perpage' 'folderid' 'showdeleted' 'ignoreRecipients'

Return values
array<string|int, mixed>
  • list of messages.

listNotifications()

Lists notifications for current user

public listNotifications([mixed $data = array() ]) : array<string|int, mixed>
Parameters
$data : mixed = array()
Tags
deprecated
5.1.6

Only used by unit tests

Return values
array<string|int, mixed>

@see vB_Library_Notification::fetchNotificationsforCurrentUser()

listRequests()

Lists messages for current user

public listRequests([mixed $data = array() ]) : mixed
Parameters
$data : mixed = array()
Return values
mixed
  • array-includes folderId, title, quantity not read. Also 'page' is array of node records for page 1.

map_vb4_input_to_vb5()

Returns vb5 api method name.

public static map_vb4_input_to_vb5(string $method, array<string|int, mixed> &$request) : string

May alter request array.

Parameters
$method : string

-- vb4 method name

$request : array<string|int, mixed>

-- $_REQUEST array for this api request

Return values
string

map_vb5_errors_to_vb4()

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

public static map_vb5_errors_to_vb4(string $method, array<string|int, mixed> &$data) : mixed
Parameters
$method : string

-- vb4 method name

$data : array<string|int, mixed>

-- error array from vb5

Return values
mixed

map_vb5_output_to_vb4()

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

public static map_vb5_output_to_vb4(string $method, array<string|int, mixed> &$data) : mixed
Parameters
$method : string

-- vb4 method name

$data : array<string|int, mixed>

-- output array from vb5

Return values
mixed

moveMessage()

Moves a message to a different folder

public moveMessage(mixed $nodeid[, mixed $newFolderid = false ]) : bool
Parameters
$nodeid : mixed
$newFolderid : mixed = false
Return values
bool

did it succeed?

previewMessages()

Gets the preview for the messages

public previewMessages() : mixed
Return values
mixed

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

resetFolders()

Clears the cached folder information

public resetFolders() : mixed
Return values
mixed

setRead()

Sets a message to read

public setRead(int $nodeid[, int $read = 1 ]) : standard
Parameters
$nodeid : int
$read : int = 1

-- 1 is read / 0 is unread

Return values
standard

success array

toTrashcan()

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

public toTrashcan(mixed $nodeid) : mixed
Parameters
$nodeid : mixed
Return values
mixed

undeleteMessage()

Moves a message back to user inbox folder

public undeleteMessage(mixed $nodeid) : bool
Parameters
$nodeid : mixed
Tags
params

int The nodeid we are undeleting.

Return values
bool

True if succesfully done.

update()

Updates a record

public update(mixed $nodeid, mixed $data) : bool
Parameters
$nodeid : mixed
$data : mixed
Return values
bool

updateFolderTitle()

Updates the title

public updateFolderTitle(mixed $folderName, mixed $folderid) : array<string|int, mixed>
Parameters
$folderName : mixed
$folderid : mixed
Return values
array<string|int, mixed>

The array of folder information for this folder.

__construct()

Constructor, no external instantiation.

protected __construct() : mixed
Return values
mixed

checkAttachmentPermissions()

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

protected checkAttachmentPermissions(array<string|int, mixed> $data[, int $nodeid = false ]) : mixed

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 : array<string|int, mixed>

Typical data array passed into add() or update(). MUST have 'parentid' for add, 'parentid' OR 'nodeid' for update. CAN have 'attachments' if any is to be added, 'removeattachments' if any is to be removed (update only).

$nodeid : int = false

-- optional node to check permissions against if the parentid isn't in the data array

Tags
throws

vB_Exception_Api('invalid_parentid') if required 'parentid' is not found in $data

throws

vB_Exception_Api('no_create_permissions_attach') if user lacks createpermissions.vbforum_attach channel permission.

throws

vB_Exception_Api('max_attachments_exceeded_x') if attachment limit check failed per above notes.

Return values
mixed

checkHasAdminPermission()

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

protected checkHasAdminPermission(string|array<string|int, mixed> $adminPermission) : none

Checks for:

  • A valid CP Session
  • The passed adminpermission.
Parameters
$adminPermission : string|array<string|int, mixed>

The admin permission to check. If an array then the check passes if the user has any of the permissions given.

Tags
throws
inlinemodauth_required

-- The current session is not a mod/admin session

throws
nopermission_loggedin

-- The user does not have the given permission

throws
no_permission

-- The user is not logged in at all.

Return values
none

checkHasPermission()

Determines if the calling user has the given bitfield permission, and if not, throws a 'no_permission' exception.

protected checkHasPermission(string $group, string $permission) : none
Parameters
$group : string

The permission group where the permission is located

$permission : string

The permission to check

Tags
throws
no_permission
Return values
none

checkHtmlstateForComments()

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

protected checkHtmlstateForComments(mixed &$data, mixed $nodeid) : void
Parameters
$data : mixed
$nodeid : mixed
Return values
void

This function modifies the passed $data array.

checkIsLoggedIn()

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

protected checkIsLoggedIn() : mixed
Return values
mixed

checkTextLength()

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.

protected checkTextLength(int $minChars, int $maxChars, string $text) : mixed

Throws an exception if validation fails.

Parameters
$minChars : int

-- check if $this->textRequired is true

$maxChars : int

-- unlimited if 0

$text : string
Return values
mixed

cleanOptions()

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

protected cleanOptions(array<string|int, mixed> &$options) : mixed
Parameters
$options : array<string|int, mixed>

Array of options, may be passed in from client

Return values
mixed

getApiClass()

protected static getApiClass(mixed $controller[, mixed $errorCheck = true ]) : mixed
Parameters
$controller : mixed
$errorCheck : mixed = true
Return values
mixed

getApiClassNameInternal()

protected static getApiClassNameInternal(mixed $controller) : mixed
Parameters
$controller : mixed
Return values
mixed

hasAdminPermission()

Determines if the calling user has the given admin permission

protected hasAdminPermission(string|array<string|int, mixed> $adminPermission) : bool

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
$adminPermission : string|array<string|int, mixed>

The admin permission to check. If an array then the check passes if the user has any of the permissions given.

Return values
bool

true if checks pass, false otherwise

inDebugMode()

protected inDebugMode() : mixed
Return values
mixed

isDisableFalseReturnOnly()

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

protected isDisableFalseReturnOnly(mixed $method) : bool
Parameters
$method : mixed
Return values
bool

Indicates whether method returns false response only.

isWhiteListed()

Checks if method is white listed when API is disabled.

protected isWhiteListed(mixed $method) : bool
Parameters
$method : mixed
Return values
bool

Indicates whether method is or is not a white list.

listSpecialPrivateMessages()

Lists messages for current user

protected listSpecialPrivateMessages([mixed $data = array() ]) : mixed
Parameters
$data : mixed = array()
Return values
mixed
  • array-includes folderId, title, quantity not read. Also 'page' is array of node records for page 1.

setController()

Set controller

protected setController(mixed $controller) : mixed
Parameters
$controller : mixed
Return values
mixed

validateRequest()

Verifies that the request exists and its valid.

protected validateRequest(int $userid, int $nodeid) : array<string|int, mixed>

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

Parameters
$userid : int
$nodeid : int
Return values
array<string|int, mixed>
  • message info

verify_limits()

Checks the "limit" permissions for this content item

protected verify_limits(mixed $data) : bool
Parameters
$data : mixed
Return values
bool

Either true if all the tests passed or thrown exception

cms_vb4_to_vb5_method_mapping()

private static cms_vb4_to_vb5_method_mapping(mixed $method, mixed &$request) : mixed
Parameters
$method : mixed
$request : mixed
Return values
mixed

default_vb4_to_vb5_method_mapping()

private static default_vb4_to_vb5_method_mapping(mixed $method) : mixed
Parameters
$method : mixed
Return values
mixed

getCharLimits()

Gets the char limits for a node's text

private getCharLimits(array<string|int, mixed> $vboptions, array<string|int, mixed> $parentNode) : array<string|int, mixed>
Parameters
$vboptions : array<string|int, mixed>

-- the vboption datastore array

$parentNode : array<string|int, mixed>

-- the node to check's parent

Return values
array<string|int, mixed>

-- array($minChars, $maxChars)

getFolderRouteInfo()

private getFolderRouteInfo(mixed $folderkey, mixed $folderid) : mixed
Parameters
$folderkey : mixed
$folderid : mixed
Return values
mixed

hasAdminPermissionInternal()

Internal function to power the previous cover functions

private hasAdminPermissionInternal(mixed $adminPermission) : mixed
@param string|array $adminPermission The admin permission to check.  If an array

then the check passes if the user has any of the permissions given.

Parameters
$adminPermission : mixed
Return values
mixed

remove_nulls()

private static remove_nulls(mixed &$data) : mixed
Parameters
$data : mixed
Return values
mixed

wrapLoggerIfNeeded()

Wrap the api object with the log wrapper class if needed.

private static wrapLoggerIfNeeded(mixed $controller, mixed $api_object) : mixed
Parameters
$controller : mixed
$api_object : mixed
Return values
mixed

Search results