class vB_Api_Content_Channel extends vB_Api_Content

vB_Api_Content_Channel

Traits

Properties

protected bool $disabled Indicates whether the API was disabled from vB_Api
protected array $disableWhiteList List of methods that which can still be called as normal even when the API is disabled due to forum being closed, password expired, IP ban, etc. from vB_Api_Content
protected array $disableFalseReturnOnly Contains white listed methods which return a false response when API is disabled in special scenarios like forum closed, password expiry, ip ban and others. from vB_Api
protected string $controller API Controller from vB_Api
protected vB_Database $db Database object. from vB_Api
protected vB_UserContext $usercontext from vB_Api_Content
protected vB_dB_Assertor $assertor from vB_Api_Content
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 $primarykey

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

Normal constructor- protected to prevent direct 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 channel.

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 the given channel

getContent($nodeid, $permissions = false)

Alias for @getFullContent

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

Returns the node content plus the channel routeid and title, and starter route and title, and permissions and other data

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(int $nodeId)

Returns an array with bbcode options for the node.

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

array
fetchChannelById(int $nodeid, array $options = array())

Returns a channel record based on its node id

array
fetchChannelByGUID(string $guid)

Returns a channel record based on its node guid

int
fetchChannelIdByGUID(string $guid)

Returns a channel id based on its node guid

mixed
fetchChannelIcon(int $nodeid, string $type = vB_Api_Filedata::SIZE_FULL)

Get a blog icon

array
getContributors(int $nodeId)

Returs the contributors for a channel

bool
switchForumCategory(bool $makeCategory, int $nodeId)

Converts a channel from a forum to a category or vice versa.

array
fetchTopLevelChannelIds()

Fetches the top level Channels/Categories

int|false
getTopLevelChannel(int|array $nodeids)

Fetches the top level Channel/Category for a node/nodes

array
canAddChannel(int $nodeid)

Tells whether or not the current user can add a new channel for the given node

true
validateIcon(int $nodeid, array $data)

Checks the permissions to upload a channel icon

getCanModerate(int|array $node)

Determines if the current user can moderate the passed node

Array
canViewReportsAndInfractions()

Returns array of data indicating user's view permissions for the report & infraction channels.

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

Normal constructor- protected to prevent direct 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 63
integer add(mixed $data, array $options = array())

Adds a new channel.

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

at line 610
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

at line 673
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

at line 582
bool update(mixed $nodeid, mixed $data)

Updates the given channel

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

in vB_Api_Content at line 441
array getFullContent(integer $nodeid, array $permissions = false)

Returns the node content plus the channel routeid and title, and starter route and title, and permissions and other data

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 163
getBbcodeOptions(int $nodeId)

Returns an array with bbcode options for the node.

Parameters

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

at line 92
array fetchChannelById(int $nodeid, array $options = array())

Returns a channel record based on its node id

Parameters

int $nodeid Node ID
array $options Options array, understands: 'moderatorperms'

Return Value

array Channel information

at line 139
array fetchChannelByGUID(string $guid)

Returns a channel record based on its node guid

Parameters

string $guid Channel GUID

Return Value

array Channel information

at line 151
int fetchChannelIdByGUID(string $guid)

Returns a channel id based on its node guid

Parameters

string $guid Channel GUID

Return Value

int Channel id

at line 189
mixed fetchChannelIcon(int $nodeid, string $type = vB_Api_Filedata::SIZE_FULL)

Get a blog icon

Parameters

int $nodeid The channel or nodeid
string $type Thumbnail version/size requested (SIZE_* constanst in vB_Api_Filedata)

Return Value

mixed the raw content of the image.

at line 277
array getContributors(int $nodeId)

Returs the contributors for a channel

Parameters

int $nodeId Channel Node ID

Return Value

array List of channel contributors/authors.

at line 389
bool switchForumCategory(bool $makeCategory, int $nodeId)

Converts a channel from a forum to a category or vice versa.

Parameters

bool $makeCategory If true it will convert the channel to a category, if false to a forum.
int $nodeId Channel Node ID.

Return Value

bool

at line 415
array fetchTopLevelChannelIds()

Fetches the top level Channels/Categories

Return Value

array Array of channel information

at line 449
int|false getTopLevelChannel(int|array $nodeids)

Fetches the top level Channel/Category for a node/nodes

Parameters

int|array $nodeids An integer Node ID or an array of int Node IDs.

Return Value

int|false Returns false on failure or the top level channel node ID.

Exceptions

vB_Exception_Api 'invalid_data'

at line 488
array canAddChannel(int $nodeid)

Tells whether or not the current user can add a new channel for the given node

Parameters

int $nodeid Nodeid to check

Return Value

array Array containing checks information. It contains two keys or the standard error array: 'can' -- to indicate if user can or can not add channel to the node. 'exceeded' -- value indicating if user already reached the max channels allowed at node level.

Exceptions

vB_Exception_Api 'invalid_data_w_x_y_z', 'no_permission'

at line 526
true validateIcon(int $nodeid, array $data)

Checks the permissions to upload a channel icon

Parameters

int $nodeid
array $data

Return Value

true Returns true if the icon is acceptible

at line 652
getCanModerate(int|array $node)

Determines if the current user can moderate the passed node

Parameters

int|array $node Node ID or array of Node IDs.

at line 708
Array canViewReportsAndInfractions()

Returns array of data indicating user's view permissions for the report & infraction channels.

Used by template widget_privatemessage_navigation

Return Value

Array
  • Array 'result' - bool 'can_view_reports' True if user can view the report channel - bool 'can_view_infractions' True if user can view the infraction channel Ex: array('result' => array('can_view_reports' => true, 'can_view_infractions' => false))