Controller to manage smilies in the admin control panel.

Controllers should implement methods named actionX with no arguments. These will be called by the dispatcher based on the requested route. They should return the object returned by responseReroute(), responseError(), or responseView(),.

All responses can take paramaters that will be passed to the container view (ie, two-phase view), if there is one.

package XenForo_Smilie

 Methods

Constructor

__construct(\Zend_Controller_Request_Http $request, \Zend_Controller_Response_Http $response, \XenForo_RouteMatch $routeMatch) 
Inherited
inherited_from \XenForo_Controller::__construct()
inherited_from \XenForo_ControllerAdmin_Abstract::__construct()

Parameters

$request

\Zend_Controller_Request_Http

$response

\Zend_Controller_Response_Http

$routeMatch

\XenForo_RouteMatch

Displays a form to add a smilie.

actionAdd() : \XenForo_Controller_ResponseAbstract

Returns

\XenForo_Controller_ResponseAbstract

Deletes the specified smilie.

actionDelete() : \XenForo_Controller_ResponseAbstract

Returns

\XenForo_Controller_ResponseAbstract

Displays a form to edit an existing smilie.

actionEdit() : \XenForo_Controller_ResponseAbstract

Returns

\XenForo_Controller_ResponseAbstract

Displays a list of smilies.

actionIndex() : \XenForo_Controller_ResponseAbstract

Returns

\XenForo_Controller_ResponseAbstract

Adds a new smilie or updates an existing one.

actionSave() : \XenForo_Controller_ResponseAbstract

Returns

\XenForo_Controller_ResponseAbstract

Validates the specified smilie field.

actionValidateField() : \XenForo_Controller_ResponseAbstract

Returns

\XenForo_Controller_ResponseAbstract

Ensures that the user trying to access the admin control panel is actually an admin.

assertAdmin() 
Inherited
inherited_from \XenForo_ControllerAdmin_Abstract::assertAdmin()

Asserts that the visiting user has the specified admin permission.

assertAdminPermission(string $permissionId) 
Inherited
inherited_from \XenForo_ControllerAdmin_Abstract::assertAdminPermission()

Parameters

$permissionId

string

Asserts that debug mode is enabled.

assertDebugMode() 
Inherited
inherited_from \XenForo_ControllerAdmin_Abstract::assertDebugMode()

Ensures that the user trying to access the page is a super admin.

assertSuperAdmin() 
Inherited
inherited_from \XenForo_ControllerAdmin_Abstract::assertSuperAdmin()

Can this controller update the session activity? Returns false by default for AJAX requests.

canUpdateSessionActivity(string $controllerName, string $action, string $newState) : boolean
Inherited

Override this in specific controllers if you want action-specific behaviour.

inherited_from \XenForo_Controller::canUpdateSessionActivity()
inherited_from \XenForo_ControllerAdmin_Abstract::canUpdateSessionActivity()

Parameters

$controllerName

string

$action

string

$newState

string

Returns

boolean

Ensures that the page that has been requested is valid based on the total number of results.

canonicalizePageNumber(integer $page, integer $perPage, integer $total, string $linkType, mixed $linkData) 
Inherited

If it's not valid, the page is redirected to the last valid page (via a response exception).

inherited_from \XenForo_Controller::canonicalizePageNumber()
inherited_from \XenForo_ControllerAdmin_Abstract::canonicalizePageNumber()

Parameters

$page

integer

$perPage

integer

$total

integer

$linkType

string

$linkData

mixed

Canonicalizes the request URL based on the given link URL.

canonicalizeRequestUrl(string $linkUrl) 
Inherited

Canonicalization will only happen when requesting an HTML page, as it is primarily an SEO benefit.

A response exception will be thrown is redirection is required.

inherited_from \XenForo_Controller::canonicalizeRequestUrl()
inherited_from \XenForo_ControllerAdmin_Abstract::canonicalizeRequestUrl()

Parameters

$linkUrl

string

Gets a dynamic redirect target based on a redirect param or the referrer.

getDynamicRedirect(string | false $fallbackUrl, boolean $useReferrer) : string
Inherited
inherited_from \XenForo_Controller::getDynamicRedirect()
inherited_from \XenForo_ControllerAdmin_Abstract::getDynamicRedirect()

Parameters

$fallbackUrl

stringfalse

Fallback if no redirect or referrer is available; if false, uses index

$useReferrer

boolean

True uses the referrer if no redirect param is available

Returns

string

Gets a specific error or a general no permission response exception.

getErrorOrNoPermissionResponseException(string | \XenForo_Phrase | mixed $errorPhraseKey, boolean $stringToPhrase) : \XenForo_ControllerResponse_Exception
Inherited

If the first param is a string and $stringToPhrase is true, it will be treated as a phrase key and turned into a phrase.

If a specific phrase is requested, a general error will be thrown. Otherwise, a generic no permission error will be shown.

inherited_from \XenForo_Controller::getErrorOrNoPermissionResponseException()
inherited_from \XenForo_ControllerAdmin_Abstract::getErrorOrNoPermissionResponseException()

Parameters

$errorPhraseKey

string\XenForo_Phrasemixed

A phrase key, a phrase object, or hard coded text. Or, may be empty.

$stringToPhrase

boolean

If true and the $errorPhraseKey is a string, $errorPhraseKey is treated as the name of a phrase.

Returns

Creates the specified helper class.

getHelper(string $class) : \XenForo_ControllerHelper_Abstract
Inherited

If no underscore is present in the class name, "XenForo_ControllerHelper_" is prefixed. Otherwise, a full class name is assumed.

inherited_from \XenForo_Controller::getHelper()
inherited_from \XenForo_ControllerAdmin_Abstract::getHelper()

Parameters

$class

string

Full class name, or partial suffix (if no underscore)

Returns

Gets the input object.

getInput() : \XenForo_Input
Inherited
inherited_from \XenForo_Controller::getInput()
inherited_from \XenForo_ControllerAdmin_Abstract::getInput()

Returns

Returns the hash necessary to find an item in a filter list.

getLastHash(mixed $id) : string
Inherited
inherited_from \XenForo_ControllerAdmin_Abstract::getLastHash()

Parameters

$id

mixed

Returns

string

Gets the specified model object from the cache.

getModelFromCache(string $class) : \XenForo_Model
Inherited

If it does not exist, it will be instantiated.

inherited_from \XenForo_Controller::getModelFromCache()
inherited_from \XenForo_ControllerAdmin_Abstract::getModelFromCache()

Parameters

$class

string

Name of the class to load

Returns

Gets a general no permission error wrapped in an exception response.

getNoPermissionResponseException() : \XenForo_ControllerResponse_Exception
Inherited
inherited_from \XenForo_Controller::getNoPermissionResponseException()
inherited_from \XenForo_ControllerAdmin_Abstract::getNoPermissionResponseException()

Returns

Gets a valid record or throws an exception.

getRecordOrError(mixed $id, \XenForo_Model $model, string $method, string $errorPhraseKey) : array
Inherited
inherited_from \XenForo_Controller::getRecordOrError()
inherited_from \XenForo_ControllerAdmin_Abstract::getRecordOrError()

Parameters

$id

mixed

ID of the record to get

$model

\XenForo_Model

Model object to request from

$method

string

Method to call in the model object

$errorPhraseKey

string

Key of error phrase to use when not found

Returns

array

Gets the request object.

getRequest() : \Zend_Controller_Request_Http
Inherited
inherited_from \XenForo_Controller::getRequest()
inherited_from \XenForo_ControllerAdmin_Abstract::getRequest()

Returns

\Zend_Controller_Request_Http

Gets the type of response that has been requested.

getResponseType() : string
Inherited
inherited_from \XenForo_Controller::getResponseType()
inherited_from \XenForo_ControllerAdmin_Abstract::getResponseType()

Returns

string

Gets the route match for this request.

getRouteMatch() : \XenForo_RouteMatch
Inherited

This can be modified to change the response type, and the major/minor sections that will be used to setup navigation.

inherited_from \XenForo_Controller::getRouteMatch()
inherited_from \XenForo_ControllerAdmin_Abstract::getRouteMatch()

Returns

Gets session activity details of activity records that are pointing to this controller.

getSessionActivityDetailsForList(array $activities) : mixed
InheritedStatic

This must check the visiting user's permissions before returning item info. Return value may be: * false - means page is unknown * string/XenForo_Phrase - gives description for all, but no item details * array (keyed by activity keys) of strings/XenForo_Phrase objects - individual description, no item details * array (keyed by activity keys) of arrays. Sub-arrays keys: 0 = description, 1 = specific item title, 2 = specific item url.

inherited_from \XenForo_Controller::getSessionActivityDetailsForList()
inherited_from \XenForo_ControllerAdmin_Abstract::getSessionActivityDetailsForList()

Parameters

$activities

array

List of activity records

Returns

mixedSee above.

Gets all the view state changes.

getViewStateChanges() : array
Inherited
inherited_from \XenForo_Controller::getViewStateChanges()
inherited_from \XenForo_ControllerAdmin_Abstract::getViewStateChanges()

Returns

arrayKey-value pairs

Checks for a match of one or more IPs against a list of IP and IP fragments

ipMatch(string | array $checkIps, array $ipList) : boolean
Inherited
inherited_from \XenForo_Controller::ipMatch()
inherited_from \XenForo_ControllerAdmin_Abstract::ipMatch()

Parameters

$checkIps

stringarray

IP address(es)

$ipList

array

List of IP addresses

Returns

boolean

Returns true if the request method is POST and an _xfConfirm parameter exists and is true

isConfirmedPost() : boolean
Inherited
inherited_from \XenForo_Controller::isConfirmedPost()
inherited_from \XenForo_ControllerAdmin_Abstract::isConfirmedPost()

Returns

boolean

This function is called immediately after an action is dispatched.

postDispatch(mixed $controllerResponse, string $controllerName, string $action) 
Inherited
inherited_from \XenForo_Controller::postDispatch()
inherited_from \XenForo_ControllerAdmin_Abstract::postDispatch()

Parameters

$controllerResponse

mixed

The response from the controller. Generally, a XenForo_ControllerResponse_Abstract object.

$controllerName

string

The name of the final controller that was invoked

$action

string

The name of the final action that was invoked

This function is called immediately before an action is dispatched.

preDispatch(string $action) 
Inherited
inherited_from \XenForo_Controller::preDispatch()
inherited_from \XenForo_ControllerAdmin_Abstract::preDispatch()

Parameters

$action

string

Action that is requested

Gets the response for a generic CAPTCHA failed error.

responseCaptchaFailed() : \XenForo_ControllerResponse_Error
Inherited
inherited_from \XenForo_Controller::responseCaptchaFailed()
inherited_from \XenForo_ControllerAdmin_Abstract::responseCaptchaFailed()

Returns

Controller response for when you want to throw an error and display it to the user.

responseError(string | array $error, integer $responseCode, array $containerParams) : \XenForo_ControllerResponse_Error
Inherited
inherited_from \XenForo_Controller::responseError()
inherited_from \XenForo_ControllerAdmin_Abstract::responseError()

Parameters

$error

stringarray

Error text to be use

$responseCode

integer

An optional HTTP response code to output

$containerParams

array

Key-value pairs of parameters to pass to the container view

Returns

Gets the exception object for controller response-style behavior.

responseException(\XenForo_ControllerResponse_Abstract $controllerResponse, integer $responseCode) : \XenForo_ControllerResponse_Exception
Inherited

This object cannot be returned from the controller; an exception must be thrown with it.

This allows any type of controller response to be invoked via an exception.

inherited_from \XenForo_Controller::responseException()
inherited_from \XenForo_ControllerAdmin_Abstract::responseException()

Parameters

$controllerResponse

\XenForo_ControllerResponse_Abstract

Type of response to invoke

$responseCode

integer

HTTP response code

Returns

Gets the response for a generic flooding page.

responseFlooding(integer $floodSeconds) : \XenForo_ControllerResponse_Error
Inherited
inherited_from \XenForo_Controller::responseFlooding()
inherited_from \XenForo_ControllerAdmin_Abstract::responseFlooding()

Parameters

$floodSeconds

integer

Numbers of seconds the user must wait to perform the action

Returns

Controller response for when you want to display a message to a user.

responseMessage(string $message, array $containerParams) : \XenForo_ControllerResponse_Message
Inherited
inherited_from \XenForo_Controller::responseMessage()
inherited_from \XenForo_ControllerAdmin_Abstract::responseMessage()

Parameters

$message

string

Error text to be use

$containerParams

array

Key-value pairs of parameters to pass to the container view

Returns

Gets the response for a generic no permission page.

responseNoPermission() : \XenForo_ControllerResponse_Error
Inherited
inherited_from \XenForo_ControllerAdmin_Abstract::responseNoPermission()

Returns

Controller response for when you want to redirect to a different URL.

responseRedirect(integer $redirectType, string $redirectTarget, mixed $redirectMessage, array $redirectParams) : \XenForo_ControllerResponse_Redirect
Inherited

This will happen in a separate request.

inherited_from \XenForo_Controller::responseRedirect()
inherited_from \XenForo_ControllerAdmin_Abstract::responseRedirect()

Parameters

$redirectType

integer

See {@link XenForo_ControllerResponse_Redirect}

$redirectTarget

string

Target to redirect to

$redirectMessage

mixed

Message with which to redirect

$redirectParams

array

Extra parameters for the redirect

Returns

Controller response for when you want to reroute to a different controller/action.

responseReroute(string $controllerName, string $action, array $containerParams) : \XenForo_ControllerResponse_Reroute
Inherited
inherited_from \XenForo_Controller::responseReroute()
inherited_from \XenForo_ControllerAdmin_Abstract::responseReroute()

Parameters

$controllerName

string

Name of the controller to reroute to

$action

string

Name of the action to reroute to

$containerParams

array

Key-value pairs of parameters to pass to the container view

Returns

Controller response for when you want to output using a view class.

responseView(string $viewName, string $templateName, array $params, array $containerParams) : \XenForo_ControllerResponse_View
Inherited
inherited_from \XenForo_Controller::responseView()
inherited_from \XenForo_ControllerAdmin_Abstract::responseView()

Parameters

$viewName

string

Name of the view class to be rendered

$templateName

string

Name of the template that should be displayed (may be ignored by view)

$params

array

Key-value pairs of parameters to pass to the view

$containerParams

array

Key-value pairs of parameters to pass to the container view

Returns

Sets a change to the view state.

setViewStateChange(string $state, mixed $data) 
Inherited
inherited_from \XenForo_Controller::setViewStateChange()
inherited_from \XenForo_ControllerAdmin_Abstract::setViewStateChange()

Parameters

$state

string

Name of state to change

$data

mixed

Updates the session records.

updateSession(mixed $controllerResponse, string $controllerName, string $action) 
Inherited

This should run on all pages, provided they not rerouting to another controller. Session saving should handle double calls, if they happen.

inherited_from \XenForo_Controller::updateSession()
inherited_from \XenForo_ControllerAdmin_Abstract::updateSession()

Parameters

$controllerResponse

mixed

The response from the controller. Generally, a XenForo_ControllerResponse_Abstract object.

$controllerName

string

$action

string

Disable updating a user's session activity in the ACP

updateSessionActivity(mixed $controllerResponse, string $controllerName, string $action) 
Inherited
inherited_from \XenForo_ControllerAdmin_Abstract::updateSessionActivity()

Parameters

$controllerResponse

mixed

The response from the controller. Generally, a XenForo_ControllerResponse_Abstract object.

$controllerName

string

$action

string

Asserts that the installed version of the board matches the files.

_assertCorrectVersion(string $action) 
Inherited
inherited_from \XenForo_ControllerAdmin_Abstract::_assertCorrectVersion()

Parameters

$action

string

_assertInstallLocked()

_assertInstallLocked($action) 
Inherited
inherited_from \XenForo_ControllerAdmin_Abstract::_assertInstallLocked()

Parameters

$action

Helper to assert that this action is available over POST only.

_assertPostOnly() 
Inherited

Throws an exception if the request is not via POST.

inherited_from \XenForo_Controller::_assertPostOnly()
inherited_from \XenForo_ControllerAdmin_Abstract::_assertPostOnly()

Checks a request for CSRF issues.

_checkCsrf(string $action) 
Inherited

This is only checked for POST requests (with session info) that aren't Ajax requests (relies on browser-level cross-domain policies).

The token is retrieved from the "_xfToken" request param.

inherited_from \XenForo_Controller::_checkCsrf()
inherited_from \XenForo_ControllerAdmin_Abstract::_checkCsrf()

Parameters

$action

string

Gets for a CSRF issue using a standard formatted token.

_checkCsrfFromToken(string $token, boolean $throw) : boolean
Inherited

Throws an exception if a CSRF issue is detected.

inherited_from \XenForo_Controller::_checkCsrfFromToken()
inherited_from \XenForo_ControllerAdmin_Abstract::_checkCsrfFromToken()

Parameters

$token

string

Format: ,,

$throw

boolean

If true, an exception is thrown when failing; otherwise, a return is used

Returns

booleanTrue if passed, false otherwise; only applies when $throw is false

Instructs a DataWriter to delete data based on a POST input parameter.

_deleteData(string $dataWriterName, string | array $existingDataKeyName, string $redirectLink, string $redirectMessage) 
Inherited
inherited_from \XenForo_Controller::_deleteData()
inherited_from \XenForo_ControllerAdmin_Abstract::_deleteData()

Parameters

$dataWriterName

string

Name of DataWriter class that will perform the deletion

$existingDataKeyName

stringarray

Name of input parameter that contains the existing data key OR array containing the keys for a multi-key parameter

$redirectLink

string

URL to which to redirect on success

$redirectMessage

string

Redirection message to show on successful deletion

Returns an array of IPs for the current client

_getClientIps() : 
Inherited
inherited_from \XenForo_Controller::_getClientIps()
inherited_from \XenForo_ControllerAdmin_Abstract::_getClientIps()

Returns

Fetches name/value/existingDataKey from input.

_getFieldValidationInputParams() : array
Inherited

Primarily used for AJAX autovalidation actions of single fields.

inherited_from \XenForo_Controller::_getFieldValidationInputParams()
inherited_from \XenForo_ControllerAdmin_Abstract::_getFieldValidationInputParams()

Returns

array[name, value, existingDataKey]

Turns a serialized (by jQuery) query string from input into a XenForo_Input object.

_getInputFromSerialized(string $varname, boolean $throw, string $errorPhraseKey) : \XenForo_Input | false
Inherited
inherited_from \XenForo_Controller::_getInputFromSerialized()
inherited_from \XenForo_ControllerAdmin_Abstract::_getInputFromSerialized()

Parameters

$varname

string

Name of index to fetch from $this->_input

$throw

boolean

On error, throw an exception or return false

$errorPhraseKey

string

Returns

_getSmilieModel()

_getSmilieModel() : \XenForo_Model_Smilie

Gets a valid smilie or throws an exception.

_getSmilieOrError(string $smilieId) : array

Parameters

$smilieId

string

Returns

array

Generic action for toggling the active state of an item or items

_getToggleResponse(array $items, string $dwName, string $redirectTarget, string $activeFieldName) : \XenForo_ControllerResponse_Abstract
Inherited
inherited_from \XenForo_ControllerAdmin_Abstract::_getToggleResponse()

Parameters

$items

array

All items of this type

$dwName

string

Name of data writer for this item type

$redirectTarget

string

Target for the redirection

$activeFieldName

string

Name of the DB field that determines active state

Returns

Performs particular actions if the request method is POST

_handlePost(string $action) 
Inherited
inherited_from \XenForo_Controller::_handlePost()
inherited_from \XenForo_ControllerAdmin_Abstract::_handlePost()

Parameters

$action

string

_logAdminRequest()

_logAdminRequest($controllerResponse, $controllerName, $action) 
Inherited
inherited_from \XenForo_ControllerAdmin_Abstract::_logAdminRequest()

Parameters

$controllerResponse

$controllerName

$action

Checks for the presence of the _xfNoRedirect parameter that is sent by AutoValidator forms when they submit via AJAX

_noRedirect() : boolean
Inherited
inherited_from \XenForo_Controller::_noRedirect()
inherited_from \XenForo_ControllerAdmin_Abstract::_noRedirect()

Returns

boolean

Method designed to be overridden by child classes to add post-dispatch behaviors

_postDispatch(mixed $controllerResponse, string $controllerName, string $action) 
Inherited
inherited_from \XenForo_Controller::_postDispatch()
inherited_from \XenForo_ControllerAdmin_Abstract::_postDispatch()

Parameters

$controllerResponse

mixed

The response from the controller. Generally, a XenForo_ControllerResponse_Abstract object.

$controllerName

string

The name of the final controller that was invoked

$action

string

The name of the final action that was invoked

Post-dispatch behaviors for the whole set of admin controllers.

_postDispatchType(mixed $controllerResponse, string $controllerName, string $action) 
Inherited

This differs from _postDispatch() in that it is designed for abstract controller type classes to override. Specific controllers should override _postDispatch instead.

inherited_from \XenForo_ControllerAdmin_Abstract::_postDispatchType()

Parameters

$controllerResponse

mixed

The response from the controller. Generally, a XenForo_ControllerResponse_Abstract object.

$controllerName

string

The name of the final controller that was invoked

$action

string

The name of the final action that was invoked

Method designed to be overridden by child classes to add pre-dispatch behaviors.

_preDispatch(string $action) 

This method should only be overridden by specific, concrete controllers.

Parameters

$action

string

Action that is requested

Method designed to be overridden by child classes to add pre-dispatch behaviors before any other pre-dispatch checks are called.

_preDispatchFirst(string $action) 
Inherited
inherited_from \XenForo_Controller::_preDispatchFirst()
inherited_from \XenForo_ControllerAdmin_Abstract::_preDispatchFirst()

Parameters

$action

string

Pre-dispatch behaviors for the whole set of admin controllers.

_preDispatchType(string $action) 
Inherited

This differs from _preDispatch() in that it is designed for abstract controller type classes to override. Specific controllers should override _preDispatch instead.

inherited_from \XenForo_ControllerAdmin_Abstract::_preDispatchType()

Parameters

$action

string

Action that is requested

Setup the session.

_setupSession(string $action) 
Inherited
inherited_from \XenForo_ControllerAdmin_Abstract::_setupSession()

Parameters

$action

string

Validates a field against a DataWriter.

_validateField(string $dataWriterName, array $data, array $options, array $extraData) : \XenForo_ControllerResponse_Redirect | \XenForo_ControllerResponse_Error
Inherited

Expects 'name' and 'value' keys to be present in the request.

inherited_from \XenForo_Controller::_validateField()
inherited_from \XenForo_ControllerAdmin_Abstract::_validateField()

Parameters

$dataWriterName

string

Name of DataWriter against which this field will be validated

$data

array

Array containing name, value or existingDataKey, which will override those fetched from _getFieldValidationInputParams

$options

array

Key-value pairs of options to set

$extraData

array

Key-value pairs of extra data to set

Returns

 Properties

 

$_executed : array
Inherited
inherited_from \XenForo_Controller::$$_executed
inherited_from \XenForo_ControllerAdmin_Abstract::$$_executed
 

$_input : \XenForo_Input
Inherited
inherited_from \XenForo_Controller::$$_input
inherited_from \XenForo_ControllerAdmin_Abstract::$$_input
 

$_modelCache : array
Inherited
inherited_from \XenForo_Controller::$$_modelCache
inherited_from \XenForo_ControllerAdmin_Abstract::$$_modelCache
 

$_request : \Zend_Controller_Request_Http
Inherited
inherited_from \XenForo_Controller::$$_request
inherited_from \XenForo_ControllerAdmin_Abstract::$$_request
 

$_response : \Zend_Controller_Response_Http
Inherited
inherited_from \XenForo_Controller::$$_response
inherited_from \XenForo_ControllerAdmin_Abstract::$$_response
 

$_routeMatch : \XenForo_RouteMatch
Inherited
inherited_from \XenForo_Controller::$$_routeMatch
inherited_from \XenForo_ControllerAdmin_Abstract::$$_routeMatch
 

$_viewStateChanges : array
Inherited

View state changes are specific to the dependency manager, but may include things like changing the styleId.

inherited_from \XenForo_Controller::$$_viewStateChanges
inherited_from \XenForo_ControllerAdmin_Abstract::$$_viewStateChanges