Documentation

AttachmentUpload
in package
implements ActionInterface

This class handles adding/deleting attachments

Table of Contents

Interfaces

ActionInterface
Interface for all action classes.

Properties

$_attachments  : array<string|int, mixed>
$_attachmentUploadDir  : string|bool
$_attachResults  : array<string|int, mixed>
$_attachSuccess  : array<string|int, mixed>
$_attchDir  : string
$_board  : int|null
$_canPostAttachment  : bool
$_currentAttachmentUploadDir  : int
$_generalErrors  : array<string|int, mixed>
$_initialError  : mixed
$_msg  : int
$_response  : array<string|int, mixed>
$_sa  : string|bool
$_subActions  : array<string|int, mixed>
$obj  : object

Methods

add()  : void
Handles adding an attachment
call()  : void
Convenience method to load() and execute() an instance of this class.
delete()  : void
Handles deleting the attachment
execute()  : void
Handles calling the appropriate function based on the sub-action
load()  : An
Wrapper for constructor. Ensures only one instance is created.
__construct()  : mixed
Attachments constructor.
createAttach()  : void
Actually attaches the file
processAttachments()  : void
Moves an attachment to the proper directory and set the relevant data into $_SESSION['temp_attachments']
sendResponse()  : void
Sends the response data
setResponse()  : void
Sets up the response information

Properties

$_attachments

protected array<string|int, mixed> $_attachments = []

Not used?

$_attachmentUploadDir

protected string|bool $_attachmentUploadDir = false

An array of info about attachment upload directories or false

$_attachResults

protected array<string|int, mixed> $_attachResults = []

An array of information about the results of each file

$_attachSuccess

protected array<string|int, mixed> $_attachSuccess = []

An array of information about successful attachments

$_attchDir

protected string $_attchDir = ''

The path to the current attachment directory

$_board

protected int|null $_board = null

The ID of the board this attachment's post is in or null if it's not set

$_canPostAttachment

protected bool $_canPostAttachment

Whether or not an attachment can be posted

$_currentAttachmentUploadDir

protected int $_currentAttachmentUploadDir

ID of the current attachment directory

$_generalErrors

protected array<string|int, mixed> $_generalErrors = []

An array of information about any errors that occurred

$_msg

protected int $_msg = 0

The ID of the message this attachment is associated with

$_response

protected array<string|int, mixed> $_response = ['error' => true, 'data' => [], 'extra' => '']

An array of response information. @used-by \sendResponse() when adding attachments

$_sa

protected string|bool $_sa = false

The current sub-action, or false if there isn't one

$_subActions

protected array<string|int, mixed> $_subActions = ['add', 'delete']

An array of all valid sub-actions

Methods

call()

Convenience method to load() and execute() an instance of this class.

public static call() : void

execute()

Handles calling the appropriate function based on the sub-action

public execute() : void

load()

Wrapper for constructor. Ensures only one instance is created.

public static load() : An
Tags
todo

Add a reference to Utils::$context['instances'] as well?

Return values
An

instance of this class.

__construct()

Attachments constructor.

protected __construct() : mixed

Sets up some initial information - the message ID, board, current attachment upload dir, etc. Protected to force instantiation via load().

createAttach()

Actually attaches the file

protected createAttach() : void

processAttachments()

Moves an attachment to the proper directory and set the relevant data into $_SESSION['temp_attachments']

protected processAttachments() : void

setResponse()

Sets up the response information

protected setResponse([array<string|int, mixed> $data = [] ]) : void
Parameters
$data : array<string|int, mixed> = []

Data for the response if we're not adding an attachment


        
On this page

Search results