vBulletin v6.0.4

vB_Library_Content_Attach extends vB_Library_Content
in package

vB_Library_Content_Attach

Tags
access

public

Table of Contents

Methods

add()  : mixed
Adds a new node.
checkConfigImageResizeLimitsForFile()  : mixed
delete()  : mixed
Remove an attachment
deleteChildren()  : mixed
Delete the records without updating the parent info. It is used when deleting a whole channel and it's children need to be removed
getAttachmentHeaders()  : array<string|int, string>
Get array of http headers for this attachment file extension
getAttachmentPermissions()  : mixed
getAttachmentsFromType()  : mixed
Get attachments for a content type
getBaseTypes()  : array<string|int, mixed>
Get array of http headers for this attachment file extension
getHeadersForTypes()  : array<string|int, mixed>
Get array of http headers for this attachment file extension
getIndexableFromNode()  : mixed
See base class for information
removeAttachment()  : mixed
Remove an attachment
removeSignaturePicture()  : mixed
saveThemeIcon()  : mixed
update()  : mixed
updates a record
uploadAttachment()  : array<string|int, mixed>
Processes an uploaded file and saves it as an attachment
uploadUrl()  : mixed
Upload an image based on the url
validate()  : bool
Validates that the current can create a node with these values
zapAttachmentType()  : mixed
Remove all attachments for content type

Methods

add()

Adds a new node.

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

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
$data : mixed

Array of field => value pairs which define the record. Must have all data required by vB_Library_Content::add(). At the minium, must have: int 'parentid' @see vB_Library_Content::add() int 'filedataid' Additional data may include: string 'caption' Optional. Caption for the image. If caption is set, it will overwrite the description. string 'description' Optional. If description is set but caption is not set, the caption will be set to description. @see vB_Library_Content::add() for more details It can also contain data corresponding to the attach table fields, such as: int 'visible' ??? int 'counter' ??? string 'filename' ??? int 'reportthreadid' ??? string 'settings' Serialized array of attachment settings that are used by vB5_Template_BbCode's attachReplaceCallback() to render the image with the specified settings. @see vB_Api_Content_Attach::getAvailableSettings() for a list of the avaliable settings @param array $options Array of options for the content being created. Understands skipTransaction, skipFloodCheck, floodchecktime

@return array Contains the data of the added node. Array with data-types & keys: int 'nodeid' bool 'success' string[] 'cacheEvents' array 'nodeVals' Array of field => value pairs representing the node table field values that were added to the node table. @see vB_Library_Node::getNodeFields() or the node table structure for these fields

$options : array<string|int, mixed> = []

checkConfigImageResizeLimitsForFile()

public checkConfigImageResizeLimitsForFile(mixed $filepath) : mixed
Parameters
$filepath : mixed

delete()

Remove an attachment

public delete(mixed $nodeid) : mixed
@param	INT	nodeid
Parameters
$nodeid : mixed

deleteChildren()

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

public deleteChildren(array<string|int, mixed> $childrenIds) : mixed
Parameters
$childrenIds : array<string|int, mixed>
  • list of node ids

getAttachmentHeaders()

Get array of http headers for this attachment file extension

public getAttachmentHeaders(string $extension) : array<string|int, string>
Parameters
$extension : string

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

Return values
array<string|int, 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.

getAttachmentPermissions()

public getAttachmentPermissions(mixed $data) : mixed
Parameters
$data : mixed

getAttachmentsFromType()

Get attachments for a content type

public getAttachmentsFromType(mixed $typeid) : mixed
@param	INT	nodeid
Parameters
$typeid : mixed

getBaseTypes()

Get array of http headers for this attachment file extension

public getBaseTypes(array<string|int, mixed> $extensions) : array<string|int, mixed>
Parameters
$extensions : array<string|int, mixed>

-- array of file extensions, e.g. 'doc', 'gif', 'pdf', 'jpg'

Return values
array<string|int, mixed>

Array of ('ext' => 'basetype')

getHeadersForTypes()

Get array of http headers for this attachment file extension

public getHeadersForTypes(array<string|int, mixed> $extensions) : array<string|int, mixed>
Parameters
$extensions : array<string|int, mixed>

-- array of file extensions, e.g. 'doc', 'gif', 'pdf', 'jpg'

Return values
array<string|int, mixed>

Array of ('ext' => header array) for each attachment. The ext keys will be returned as lower case. If no extension is found or the header is black, the default 'Content-type: application/octet-stream' is returned in the array.

getIndexableFromNode()

See base class for information

public getIndexableFromNode(mixed $node[, mixed $include_attachments = true ]) : mixed
Parameters
$node : mixed
$include_attachments : mixed = true

removeAttachment()

Remove an attachment

public removeAttachment(mixed $id) : mixed
@param	INT	nodeid
Parameters
$id : mixed

removeSignaturePicture()

public removeSignaturePicture(mixed $userid) : mixed
Parameters
$userid : mixed

saveThemeIcon()

public saveThemeIcon(mixed $userid, mixed $filearray, mixed $fileContents, mixed $filesize, mixed $extension[, mixed $imageOnly = false ][, mixed $skipUploadPermissionCheck = false ]) : mixed
Parameters
$userid : mixed
$filearray : mixed
$fileContents : mixed
$filesize : mixed
$extension : mixed
$imageOnly : mixed = false
$skipUploadPermissionCheck : mixed = false

update()

updates a record

public update(mixed $nodeid, mixed $data) : mixed
Parameters
$nodeid : mixed
$data : mixed

uploadAttachment()

Processes an uploaded file and saves it as an attachment

public uploadAttachment(int $userid, array<string|int, mixed> $file[, bool $cheperms = true ][, bool $imageOnly = false ]) : array<string|int, mixed>
Parameters
$userid : int

Userid of the user who is uploading the file

$file : array<string|int, mixed>

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

$cheperms : bool = true

Optional, whether or not to check attachment permissions. Default true

$imageOnly : bool = false

Optional, whether or not to only allow an image attachment. Default false

Tags
throws
vB_Exception_Api

If file upload by PHP failed with error code UPLOAD_ERR_INI_SIZE or UPLOAD_ERR_FORM_SIZE

throws
vB_Exception_Api

If file upload by PHP failed with error code UPLOAD_ERR_PARTIAL

throws
vB_Exception_Api

If file upload by PHP failed with error code UPLOAD_ERR_NO_FILE

throws
vB_Exception_Api

If file upload by PHP failed with error code UPLOAD_ERR_NO_TMP_DIR

throws
vB_Exception_Api

If file upload by PHP failed with error code UPLOAD_ERR_CANT_WRITE

throws
vB_Exception_Api

If file upload by PHP failed with error code UPLOAD_ERR_EXTENSION

throws
Exception

If file upload by PHP failed with an error code that's not included above

throws
vB_Exception_Api

If $file['tmp_name'] contains no data

throws
vB_Exception_Api

If user exceeded their usergroup's attachlimit

throws
vB_Exception_Api

If the uploaded file exceeds allowed dimensions and resizing the image failed

throws
vB_Exception_Api

If fetching getAttachmentPermissions() failed for specified file type & upload method

access

public

Return values
array<string|int, mixed>

Array of attachment data @see saveUpload()

uploadUrl()

Upload an image based on the url

public uploadUrl(mixed $userid, mixed $url[, mixed $attachment = false ][, mixed $uploadfrom = '' ]) : mixed

@param int user ID

Parameters
$userid : mixed
$url : mixed
$attachment : mixed = false
$uploadfrom : mixed = ''
Return values
mixed

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

validate()

Validates that the current can create a node with these values

public validate(mixed $data[, mixed $action = self::ACTION_ADD ][, mixed $nodeid = false ][, mixed $nodes = false ][, mixed $userid = null ]) : bool
Parameters
$data : mixed
$action : mixed = self::ACTION_ADD
$nodeid : mixed = false
$nodes : mixed = false
$userid : mixed = null
Return values
bool

zapAttachmentType()

Remove all attachments for content type

public zapAttachmentType(mixed $typeid) : mixed
@param	INT	Content Type id
Parameters
$typeid : mixed

        
On this page

Search results