class vB_Library_Content_Attach extends vB_Library_Content

vB_Library_Content_Attach

Traits

Constants

ACTION_ADD

ACTION_UPDATE

ACTION_VIEW

ACTION_DELETE

ACTION_APPROVE

ACTION_PUBLISH

CACHELEVEL_NODE

CACHELEVEL_CONTENT

CACHELEVEL_FULLCONTENT

Properties

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

Methods

__sleep()

No description

__wakeup()

No description

__construct()

No description

static vB_PageCache
instance($class)

Returns singleton instance of self.

static 
getLibraryClassNameInternal($controller)

No description

static 
getContentInstance($contenttypeid)

No description

static 
clearCache()

No description

reloadOptions()

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

fetchContentType()

No description

getAllCanView()

No description

fetchContentTypeId()

No description

int
getTextCountChange()

Returns textCountChange property

int
getInlist()

Returns inlist property

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

Adds a new node.

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

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

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

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

sendModeratorNotification($nodeid)

Sends emails to moderators configured in admincp

needsFloodCheck($data, $options)

No description

checkFloodAndThrowException($data)

No description

string|boolean
duplicateCheck(array $data)

Checks accidental duplicate posting

updateNodeOptions($nodeid, $data)

Sets node options from individual fields.

incrementUserPostCount(array $node)

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

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

Decrements the number of posts for a user

resetCountCalled()

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

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

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

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

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

boolean
delete($nodeid)

Remove an attachment

deleteChildren(array $childrenIds)

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

bool
isPublished(mixed $data)

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

update(int $nodeid, array $data)

updates a record

static mixed
getContentApi(int $contenttypeid)

Returns a content api of the appropriate type

static mixed
getContentLib(int $contenttypeid)

Returns a content api of the appropriate type

int
getContent($nodeids)

Returns the node content as an associative array

Array[Int]
getBareContent(integer $nodeids)

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

array
getFullContent($nodeids)

Returns the node content plus the channel routeid and title, and starter route and title the as an associative array

array
getRawContent($nodeids)

Prepares basic content. Used by both getBareContent and getFullContent.

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

Determines whether the current user can edit a node

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

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

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

Determines whether the current user can moderate

Array
assembleContent(Array $content)

Assembles the response for detailed content

getIndexableFromNode($node, $include_attachments = true)

See base class for information

array
getIndexableContent($nodeId, $include_attachments = true)

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

int
getStarter(int $nodeid)

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

array
getConversationParent(int $nodeid)

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

bool
isVisitorMessage(int $nodeid)

determines whether a specific node is a visitor message

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

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

getIndexableContentForAttachments($nodeId)

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

Array
fetchTableName()

returns the tables used by this content type.

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

This attempts to get the cached data for nodes

static void
writeToCache($nodes, $level)

writes new cached data for nodes

verifyPrefixid($prefixid)

No description

verifyPostIconid(int $posticonid)

Verifies that the post iconid is valid

changeContentType($nodeid, $oldcontentType, $newcontentType)

No description

string
getDuplicateHash(array $data)

Calculates the CRC based on the indexable content

fillContentTableData($node)

No description

none
removePrivateDataFromNode(array $node)

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

bool
checkComplete(array $node)

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

boolean
getCannotDelete()

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

bool
getNodeClean(integer $node)

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

bool
incompleteNodeCleanup(mixed $node)

This cleans up for a node that was found to be incomplete by deleting the child nodes and subsidiary table records. It is often overridden in child classes.

setDoIncompleteNodeCleanup(bool $value)

Sets the $doIncompleteNodeCleanup flag

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

This function needs to be implemented by sub classes that want to handle attachments. See the text library implementation for the full description.

mergeContentInfo($result, $content)

No description

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

Validates that the current can create a node with these values

removeAttachment($id)

Remove an attachment

removeSignaturePicture($userid)

No description

getAttachmentsFromType($typeid)

Get attachments for a content type

zapAttachmentType($typeid)

Remove all attachments for content type

string[]
getAttachmentHeaders(string $extension)

Get array of http headers for this attachment file extension

array
uploadAttachment(int $userid, array|object $file, bool $cheperms = true, bool $imageOnly = false)

Processes an uploaded file and saves it as an attachment

getAttachmentPermissions($data)

No description

bool
resizeImage(int $userid, array $filearray, string $fileContents, int $filesize, int $filewidth, int $fileheight, string $extension, array $targets)

Attempts to resize an uploaded image so that it can be saved as an attachment.

mixed
uploadUrl($userid, $url, $attachment = false, $uploadfrom = '')

Upload an image based on the url

saveThemeIcon($userid, $filearray, $fileContents, $filesize, $extension, $imageOnly = false, $skipUploadPermissionCheck = false)

No description

verifyAttachmentPath($userid)

No description

fetchAttachmentPath($userid, $attachmentid = 0, $thumb = false, $overridepath = '')

No description

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

at line 49
protected __construct()

in vB_Library at line 35
static vB_PageCache instance($class)

Returns singleton instance of self.

Parameters

$class

Return Value

vB_PageCache
  • Reference to singleton instance of the cache handler

in vB_Library at line 52
static protected getLibraryClassNameInternal($controller)

Parameters

$controller

in vB_Library at line 91
static getContentInstance($contenttypeid)

Parameters

$contenttypeid

in vB_Library at line 99
static clearCache()

in vB_Library_Content at line 158
reloadOptions()

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

in vB_Library_Content at line 163
fetchContentType()

in vB_Library_Content at line 172
getAllCanView()

in vB_Library_Content at line 177
fetchContentTypeId()

in vB_Library_Content at line 186
int getTextCountChange()

Returns textCountChange property

Return Value

int

in vB_Library_Content at line 195
int getInlist()

Returns inlist property

Return Value

int

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

Adds a new node.

This function will add a new attachment node & attach table record, increment refcount for the associated filedata table record, and set the parent node record's hasphoto to 1

Parameters

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

@return mixed       array with nodeid (int), success (bool), cacheEvents (array of strings), nodeVals (array of field => value).

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

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

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

Takes the same parameters as afterAdd

Parameters

$nodeid
$data
$options
$cacheEvents
$nodevals

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

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

Parameters

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

in vB_Library_Content at line 1132
protected sendModeratorNotification($nodeid)

Sends emails to moderators configured in admincp

Parameters

$nodeid

in vB_Library_Content at line 1322
protected needsFloodCheck($data, $options)

Parameters

$data
$options

in vB_Library_Content at line 1334
protected checkFloodAndThrowException($data)

Parameters

$data

in vB_Library_Content at line 1366
protected string|boolean duplicateCheck(array $data)

Checks accidental duplicate posting

Parameters

array $data

Return Value

string|boolean hash or false if check skipped

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

Sets node options from individual fields.

@param int

Parameters

$nodeid
$data

in vB_Library_Content at line 1435
incrementUserPostCount(array $node)

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

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

Parameters

array $node Array of node information for the affected node

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

Decrements the number of posts for a user

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

Parameters

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

in vB_Library_Content at line 1541
resetCountCalled()

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

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

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

Parameters

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

Return Value

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

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

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

Parameters

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

Return Value

boolean Whether or not the child nodes should be handled

at line 145
boolean delete($nodeid)

Remove an attachment

@param INT nodeid

Parameters

$nodeid

Return Value

boolean

at line 172
deleteChildren(array $childrenIds)

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

Parameters

array $childrenIds
  • list of node ids

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

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

Parameters

mixed $data

Return Value

bool

at line 199
update(int $nodeid, array $data)

updates a record

Parameters

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

@return boolean

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

Returns a content api of the appropriate type

Parameters

int $contenttypeid the content type id

Return Value

mixed content api object

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

Returns a content api of the appropriate type

Parameters

int $contenttypeid the content type id

Return Value

mixed content api object

in vB_Library_Content at line 2395
int getContent($nodeids)

Returns the node content as an associative array

Parameters

$nodeids

Return Value

int

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

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

Parameters

integer $nodeids The id in the primary table.

Return Value

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

in vB_Library_Content at line 2439
array getFullContent($nodeids)

Returns the node content plus the channel routeid and title, and starter route and title the as an associative array

Parameters

$nodeids

Return Value

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

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

Prepares basic content. Used by both getBareContent and getFullContent.

Parameters

$nodeids

Return Value

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

Exceptions

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

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

Determines whether the current user can edit a node

Parameters

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

Return Value

bool

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

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

Parameters

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

Return Value

bool

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

Determines whether the current user can moderate

Parameters

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

Return Value

bool

in vB_Library_Content at line 2959
Array assembleContent(Array $content)

Assembles the response for detailed content

Parameters

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

Return Value

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

at line 268
getIndexableFromNode($node, $include_attachments = true)

See base class for information

Parameters

$node
$include_attachments

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

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

Parameters

$nodeId
$include_attachments

Return Value

array $indexableContent

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

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

Parameters

int $nodeid

Return Value

int The conversation starter's nodeid

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

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

Parameters

int $nodeid

Return Value

array The starter node array

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

determines whether a specific node is a visitor message

Parameters

int $nodeid

Return Value

bool

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

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

Parameters

int $nodeid Node ID
array $node Node information

Return Value

bool

in vB_Library_Content at line 3681
protected getIndexableContentForAttachments($nodeId)

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

Parameters

$nodeId

in vB_Library_Content at line 3702
Array fetchTableName()

returns the tables used by this content type.

Return Value

Array

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

This attempts to get the cached data for nodes

Parameters

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

Return Value

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

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

writes new cached data for nodes

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

Parameters

$nodes
$level

Return Value

void

in vB_Library_Content at line 3816
protected verifyPrefixid($prefixid)

Parameters

$prefixid

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

Verifies that the post iconid is valid

Parameters

int $posticonid post icon ID

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

Parameters

$nodeid
$oldcontentType
$newcontentType

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

Calculates the CRC based on the indexable content

Parameters

array $data

Return Value

string

in vB_Library_Content at line 3930
protected fillContentTableData($node)

Parameters

$node

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

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

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

Parameters

array $node the node array to be cleaned.

Return Value

none

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

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

Parameters

array $node -- node array

Return Value

bool

in vB_Library_Content at line 3996
boolean getCannotDelete()

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

Return Value

boolean

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

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

Parameters

integer $node the nodeid to be checked

Return Value

bool

in vB_Library_Content at line 4036
protected bool incompleteNodeCleanup(mixed $node)

This cleans up for a node that was found to be incomplete by deleting the child nodes and subsidiary table records. It is often overridden in child classes.

Parameters

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

Return Value

bool Whether the node has been cleaned up

in vB_Library_Content at line 4095
setDoIncompleteNodeCleanup(bool $value)

Sets the $doIncompleteNodeCleanup flag

Parameters

bool $value Flag value

in vB_Library_Content at line 4105
protected handleAttachments($type, $nodeid, $data, $options = array())

This function needs to be implemented by sub classes that want to handle attachments. See the text library implementation for the full description.

Parameters

$type
$nodeid
$data
$options

in vB_Library_Content at line 4108
mergeContentInfo($result, $content)

Parameters

$result
$content

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

Validates that the current can create a node with these values

Parameters

$data
$action
$nodeid
$nodes
$userid

Return Value

bool

at line 285
removeAttachment($id)

Remove an attachment

@param INT nodeid

Parameters

$id

at line 324
removeSignaturePicture($userid)

Parameters

$userid

at line 363
getAttachmentsFromType($typeid)

Get attachments for a content type

@param INT nodeid

Parameters

$typeid

at line 374
zapAttachmentType($typeid)

Remove all attachments for content type

@param INT Content Type id

Parameters

$typeid

at line 395
string[] getAttachmentHeaders(string $extension)

Get array of http headers for this attachment file extension

Parameters

string $extension file extension, e.g. 'doc', 'gif', 'pdf', 'jpg'

Return Value

string[] Array containing the 'content-type' http header string for $extension. If $extension is not found in attachmenttype table, the default 'Content-type: application/octet-stream' is returned in the array.

at line 447
array uploadAttachment(int $userid, array|object $file, bool $cheperms = true, bool $imageOnly = false)

Processes an uploaded file and saves it as an attachment

Parameters

int $userid Userid of the user who is uploading the file
array|object $file Uploaded file data. The object or array should have the following properties or elements with data-types and names: string 'name' Filename int 'size' Filesize string 'type' Filetype string 'uploadfrom' Optional. Where the file was uploaded from. E.g. 'profile', 'sgicon', 'signature', 'newContent' or null int 'parentid' Optional. The nodeid/channelid this file should be saved under. Used for permission checks If it is an object, it should also have the following property: string 'contents' Contents of the file If it is an array, it should also have the following element: string 'tmp_name' Filepath to the temporary file created on the server
bool $cheperms Optional, whether or not to check attachment permissions. Default true
bool $imageOnly Optional, whether or not to only allow an image attachment. Default false

Return Value

array Array of attachment data see saveUpload()

Exceptions

vB_Exception_Api('upload_file_exceeds_php_limit') If file upload by PHP failed with error code UPLOAD_ERR_INI_SIZE or UPLOAD_ERR_FORM_SIZE
vB_Exception_Api('upload_file_partially_uploaded') If file upload by PHP failed with error code UPLOAD_ERR_PARTIAL
vB_Exception_Api('upload_file_failed') If file upload by PHP failed with error code UPLOAD_ERR_NO_FILE
vB_Exception_Api('missing_temporary_folder') If file upload by PHP failed with error code UPLOAD_ERR_NO_TMP_DIR
vB_Exception_Api('upload_writefile_failed') If file upload by PHP failed with error code UPLOAD_ERR_CANT_WRITE
vB_Exception_Api('upload_stopped_by_extension') If file upload by PHP failed with error code UPLOAD_ERR_EXTENSION
Exception('Upload failed. PHP upload error: ' ) If file upload by PHP failed with an error code that's not included above
vB_Exception_Api('invalid_file_data') If $file['tmp_name'] contains no data
vB_Exception_Api('upload_file_exceeds_limit') If user exceeded their usergroup's attachlimit
vB_Exception_Api('upload_exceeds_dimensions') If the uploaded file exceeds allowed dimensions and resizing the image failed
vB_Exception_Api('invalid_file') If fetching getAttachmentPermissions() failed for specified file type & upload method

at line 1055
getAttachmentPermissions($data)

Parameters

$data

at line 1220
protected bool resizeImage(int $userid, array $filearray, string $fileContents, int $filesize, int $filewidth, int $fileheight, string $extension, array $targets)

Attempts to resize an uploaded image so that it can be saved as an attachment.

If successful, it modifies $filearray, $fileContents, $filesize, $filewidth, $fileheight, $extension, and the temporary file as saved on disk, then returns true.

Parameters

int $userid user id
array $filearray file data array
string $fileContents file contents
int $filesize file size
int $filewidth file width
int $fileheight file height
string $extension extension
array $targets target sizes (width, height, filesize)

Return Value

bool Returns false if the image is not successfully resized, so the calling code can throw a size (dimensions or filesize) error

at line 1422
mixed uploadUrl($userid, $url, $attachment = false, $uploadfrom = '')

Upload an image based on the url

@param int user ID

Parameters

$userid
$url
$attachment
$uploadfrom

Return Value

mixed array of data, includes filesize, dateline, htmltype, filename, extension, and filedataid

at line 1542
saveThemeIcon($userid, $filearray, $fileContents, $filesize, $extension, $imageOnly = false, $skipUploadPermissionCheck = false)

Parameters

$userid
$filearray
$fileContents
$filesize
$extension
$imageOnly
$skipUploadPermissionCheck

at line 1912
protected verifyAttachmentPath($userid)

Parameters

$userid

at line 1928
protected fetchAttachmentPath($userid, $attachmentid = 0, $thumb = false, $overridepath = '')

Parameters

$userid
$attachmentid
$thumb
$overridepath