class AddFile extends FrontendController (View source)

Traits

Trait ApplicationAwareTrait A trait used with ApplicationAwareInterface

Constants

protected FIELDNAME_PAGEID

The name of the request field that contains the page ID.

protected FIELDNAME_AREAHANDLE

The name of the request field that contains the area handle.

protected FIELDNAME_BLOCKID

The name of the request field that contains the block ID.

Properties

protected Application $app from  ApplicationAwareTrait
protected string[] $helpers

The handles of the helpers to be returned by the getHelperObjects method.

from  AbstractController
protected array $sets

The values to be sent to views.

from  AbstractController
protected string|null $action

The action to be performed.

from  AbstractController
protected Request|null $request

The current request instance.

from  AbstractController
protected array|null $parameters

The action parameters.

from  AbstractController
protected $view from  Controller
protected string $viewPath

The path to the view file (update it with the setViewPath method).

from  Controller
protected $theme from  Controller
protected $controllerActionPath from  Controller
protected $themeViewTemplate from  Controller
private int|false|null $pageID

The page ID as specified by the request.

from  FrontendController
private Page|null $page

The page as specified by the request.

from  FrontendController
private string|null $areaHandle

The handle of the area as specified by the request.

from  FrontendController
private Area|null $area

The area as specified by the request.

from  FrontendController
private int|false|null $blockID

The block ID as specified by the request.

from  FrontendController
private Block|null $block

The block instance as specified by the request.

from  FrontendController
private Controller|null $blockController

The block controller as specified by the request.

from  FrontendController
private Conversation $blockConversation

The Conversation instance for in tbe block specified by the request.

from  FrontendController

Methods

setApplication(Application $app)

Setter method for the application

__construct()

Initialize the instance.

Request
getRequest()

Get the current request instance.

setRequest(Request $request)

Set the current request instance.

requireAsset()

Add an asset required in views.

addHeaderItem(string $item)

Adds an item to the view's header. This item will then be automatically printed out before the section of the page.

addFooterItem(string $item)

Adds an item to the view's footer. This item will then be automatically printed out before the section of the page.

set(string $key, mixed $val)

Set a value to be sent to the view.

array
getSets()

Get the values to be sent to views.

bool
shouldRunControllerTask()

Should the action be executed? Override this method to answer something different than true.

array
getHelperObjects()

Get the the helpers that will be be automatically sent to Views as variables.

mixed
get(string|null $key = null, mixed $defaultValue = null)

Get the whole $_GET array or a specific querystring value.

getTask() deprecated

No description

string|null
getAction()

Get the action to be performed.

array|null
getParameters()

Get the action parameters.

on_start()

Override this method to perform controller initializations.

on_before_render()

Override this method to do something right before the view is rendered.

isPost() deprecated

No description

mixed
post(string|null $key = null, mixed $defaultValue = null)

Get the whole $_POST array or a specific posted value.

redirect() deprecated

Redirect the clients to a specific URL/page (specify path(s) as argument(s) of this function).

RedirectResponse
buildRedirect(array|string|UrlInterface $destination, int $httpResponseCode = Response::HTTP_FOUND)

Build a response that redirects clients to a specific URL/page (specify path(s) as argument(s) of $args).

runTask(mixed $action, mixed $parameters) deprecated

No description

mixed
runAction(string $action, array $parameters = [])

Perform an action of this controller (if shouldRunControllerTask returns true).

mixed
request(string|null $key = null)

Get the whole $_REQUEST array or a specific requested value.

executeCommand(mixed $command)

Dispatches a command to the command bus.

dispatchBatch(Batch $batch)

No description

setViewObject(View $view)

No description

setTheme($mixed)

No description

getTheme()

No description

setThemeViewTemplate($template)

No description

string
getThemeViewTemplate()

Returns the wrapper file that holds the content of the view. Usually view.php.

getControllerActionPath()

No description

string
getViewPath()

Get the path to the view file.

flash($key, $value, $isHTML = false)

No description

getViewObject()

No description

action()

No description

setViewPath(string $viewPath)

Set the path to the view file.

int|null
getPageID()

Get the page ID as specified by the request.

getPage()

Get the page as specified by the request.

string
getAreaHandle()

Get the handle of the area as specified by the request.

getArea()

Get the area as specified by the details of the request.

int|null
getBlockID()

Get the block ID as specified by the request.

getBlock()

Get the block instance as specified by the details of the request.

getBlockController()

Get the block controller as specified by the request.

getBlockConversation()

Get the block controller as specified by the request.

Response
view()

No description

void
checkToken()

No description

void
checkConversation(Conversation $conversation)

No description

UploadedFile
getPostedFile()

No description

void
checkPostedFileLimits(Conversation $conversation, UploadedFile $file)

No description

array
getAttachmentLimits(Conversation $conversation)

No description

void
checkPostedFileExtension(Conversation $conversation, UploadedFile $file)

No description

array
getDenylistedFileExtensions(Conversation $conversation)

Get the list of denylisted file extensions (lower case).

array
getAllowedFileExtensions(Conversation $conversation)

Get the list of allowed file extensions (lower case).

importFile(Conversation $conversation, UploadedFile $file)

No description

Set|null
assignImportedFileToFileSet(Conversation $conversation, Version $fileVersion)

No description

Set|null
getFileSetForUploadedFile(Conversation $conversation)

No description

Details

setApplication(Application $app)

Setter method for the application

Parameters

Application $app

__construct()

Initialize the instance.

Request getRequest()

Get the current request instance.

Return Value

Request

setRequest(Request $request)

Set the current request instance.

Parameters

Request $request

See also

AbstractController::setRequest

requireAsset()

Add an asset required in views.

This function accept the same parameters as the requireAsset method of the ResponseAssetGroup.

See also

ResponseAssetGroup::requireAsset

addHeaderItem(string $item)

Adds an item to the view's header. This item will then be automatically printed out before the section of the page.

Parameters

string $item

addFooterItem(string $item)

Adds an item to the view's footer. This item will then be automatically printed out before the section of the page.

Parameters

string $item

set(string $key, mixed $val)

Set a value to be sent to the view.

Parameters

string $key

The name of the value

mixed $val

The value

array getSets()

Get the values to be sent to views.

Return Value

array

bool shouldRunControllerTask()

Should the action be executed? Override this method to answer something different than true.

Return Value

bool

array getHelperObjects()

Get the the helpers that will be be automatically sent to Views as variables.

Array keys are the variable names, array values are the helper instances.

Return Value

array

mixed get(string|null $key = null, mixed $defaultValue = null)

Get the whole $_GET array or a specific querystring value.

Parameters

string|null $key

set to null to get the whole $_GET array, or a string to get a specific value in the controller sets or from the querystring parameters

mixed $defaultValue

what to return if $key is specified but it does not exist neither in the sets nor in the querystring

Return Value

mixed

getTask() deprecated

deprecated use the getAction() method

No description

string|null getAction()

Get the action to be performed.

Return Value

string|null

array|null getParameters()

Get the action parameters.

Return Value

array|null

on_start()

Override this method to perform controller initializations.

on_before_render()

Override this method to do something right before the view is rendered.

For instance, you can call $this->set('variableName', $variableValue) to send the view additional sets.

isPost() deprecated

deprecated Use $this->getRequest()->isPost();

No description

mixed post(string|null $key = null, mixed $defaultValue = null)

Get the whole $_POST array or a specific posted value.

Parameters

string|null $key

set to null to get the whole $_POST array, or a string to get a specific posted value (resulting strings will be trimmed)

mixed $defaultValue

what to return if $key is specified but it does not exist in the $_POST

Return Value

mixed

redirect() deprecated

deprecated you should return a Response instance from your methods

Redirect the clients to a specific URL/page (specify path(s) as argument(s) of this function).

RedirectResponse buildRedirect(array|string|UrlInterface $destination, int $httpResponseCode = Response::HTTP_FOUND)

Build a response that redirects clients to a specific URL/page (specify path(s) as argument(s) of $args).

Parameters

array|string|UrlInterface $destination

use an Url object to specify the destination URL, or a string/array of strings to build the URL with the resolver

int $httpResponseCode

the HTTP response code

Return Value

RedirectResponse

runTask(mixed $action, mixed $parameters) deprecated

deprecated use the runAction method

No description

Parameters

mixed $action
mixed $parameters

mixed runAction(string $action, array $parameters = [])

Perform an action of this controller (if shouldRunControllerTask returns true).

Parameters

string $action

the action to be performed

array $parameters

the action parameters

Return Value

mixed

in case the action is executed, you'll receive the result of the action, or NULL otherwise

mixed request(string|null $key = null)

Get the whole $_REQUEST array or a specific requested value.

Parameters

string|null $key

set to null to get the whole $_REQUEST array, or a string to get a specific value in $_GET or in $_POST

Return Value

mixed

executeCommand(mixed $command)

Dispatches a command to the command bus.

Parameters

mixed $command

dispatchBatch(Batch $batch)

No description

Parameters

Batch $batch

setViewObject(View $view)

No description

Parameters

View $view

setTheme($mixed)

No description

Parameters

$mixed

getTheme()

No description

setThemeViewTemplate($template)

No description

Parameters

$template

string getThemeViewTemplate()

Returns the wrapper file that holds the content of the view. Usually view.php.

Return Value

string

getControllerActionPath()

No description

string getViewPath()

Get the path to the view file.

Return Value

string

flash($key, $value, $isHTML = false)

No description

Parameters

$key
$value
$isHTML

getViewObject()

No description

action()

No description

protected Controller setViewPath(string $viewPath)

Set the path to the view file.

Parameters

string $viewPath

Return Value

Controller

protected int|null getPageID()

Get the page ID as specified by the request.

Return Value

int|null

Returns NULL if not received, or not a positive integer

protected Page getPage()

Get the page as specified by the request.

Return Value

Page

Exceptions

UserMessageException

protected string getAreaHandle()

Get the handle of the area as specified by the request.

Return Value

string

it may be empty

protected Area getArea()

Get the area as specified by the details of the request.

Return Value

Area

Exceptions

UserMessageException

protected int|null getBlockID()

Get the block ID as specified by the request.

Return Value

int|null

Returns NULL if not received, or not a positive integer

protected Block getBlock()

Get the block instance as specified by the details of the request.

Return Value

Block

Exceptions

UserMessageException

protected Controller getBlockController()

Get the block controller as specified by the request.

Return Value

Controller

Exceptions

UserMessageException

protected Conversation getBlockConversation()

Get the block controller as specified by the request.

Return Value

Conversation

Exceptions

UserMessageException

Response view()

No description

Return Value

Response

protected void checkToken()

No description

Return Value

void

Exceptions

UserMessageException

protected void checkConversation(Conversation $conversation)

No description

Parameters

Conversation $conversation

Return Value

void

Exceptions

UserMessageException

protected UploadedFile getPostedFile()

No description

Return Value

UploadedFile

Exceptions

UserMessageException

protected void checkPostedFileLimits(Conversation $conversation, UploadedFile $file)

No description

Parameters

Conversation $conversation
UploadedFile $file

Return Value

void

Exceptions

UserMessageException

protected array getAttachmentLimits(Conversation $conversation)

No description

Parameters

Conversation $conversation

Return Value

array

First element: max file size (int; NULL: unlimited), second element: max quantity (int, or NULL if unlimited)

protected void checkPostedFileExtension(Conversation $conversation, UploadedFile $file)

No description

Parameters

Conversation $conversation
UploadedFile $file

Return Value

void

Exceptions

UserMessageException

protected array getDenylistedFileExtensions(Conversation $conversation)

Get the list of denylisted file extensions (lower case).

Parameters

Conversation $conversation

Return Value

array

protected array getAllowedFileExtensions(Conversation $conversation)

Get the list of allowed file extensions (lower case).

Parameters

Conversation $conversation

Return Value

array

protected Version importFile(Conversation $conversation, UploadedFile $file)

No description

Parameters

Conversation $conversation
UploadedFile $file

Return Value

Version

protected Set|null assignImportedFileToFileSet(Conversation $conversation, Version $fileVersion)

No description

Parameters

Conversation $conversation
Version $fileVersion

Return Value

Set|null

protected Set|null getFileSetForUploadedFile(Conversation $conversation)

No description

Parameters

Conversation $conversation

Return Value

Set|null