This class contains some helper methods for handling view requests. Be careful
always when outputting raw user data to HTML or when handling POST requests because
insufficient protection will lead to XSS and CSRF vulnerabilities.
category
|
System
|
package
|
AdminHttpViewControllers
|
Methods
__construct
__construct(\HttpContextReaderInterface $httpContextReader, \HttpResponseProcessorInterface $httpResponseProcessor, \ContentViewInterface $defaultContentView)
inherited
Invokes an action method by the given action name.
_callActionMethod(string $actionName) : \HttpControllerResponseInterface
inherited
Throws |
- \LogicException
If no action method of the given name exists.
|
Arguments
$actionName
string
Name of action method to call, without 'action'-Suffix.
Response
\HttpControllerResponseInterface
Response message.
Detects file uploads for scriptpages and returns the array for new content_file post data.
_checkScriptpageFileUploads() : array
Creates the content navigation object for the content manager templates.
_createContentNavigation(\LanguageTextManager $languageTextManager, string|null $current = null) : \ContentNavigationCollection
inherited
Arguments
$languageTextManager
\LanguageTextManager
Text manager instance to fetch texts.
$current
string|null
(Optional) Whether "pages", "elements" or "productContents" to
set nav item active.
Response
\ContentNavigationCollection
Creates a new content group id.
_createNewContentGroupId(\CI_DB_query_builder $queryBuilder) : integer
inherited
Arguments
$queryBuilder
\CI_DB_query_builder
Query builder instance to access the database.
Response
integer
New content manager group id.
Returns the assets for the content manager editing and creation pages.
_getAssets() : \AssetCollection
inherited
Returns required data for CkEditor settings.
_getCkEditorData(integer $contentId, string $type) : array
Arguments
$contentId
integer
Content manager tables "content_group" value.
$type
string
Content type, whether "content", "file" or "link".
Response
array
Executes an sql query again the content_manager table and returns the result.
_getContentDataById(integer $contentId) : array
Arguments
$contentId
integer
Content manager tables "content_group" value.
Response
array
Content manager table data.
Detects the content type names from the queries result data.
_getContentDescription(string $contentType) : string
Arguments
$contentType
string
Must be whether "link", "file" or "content".
Response
string
Names of content types for whether "link", "file" or "content".
Returns the content edit data array, which will be
converted to a key value collection and assigned to the edit form.
_getContentEditData(integer $contentId, array $contentData) : array
Arguments
$contentId
integer
Id of content manager entry to be edited.
$contentData
array
Content manager data to be edited.
Response
array
Prepares the given content manager data to use it in the edit form.
_getContentManagerEditData(array $contentManagerData) : array
Arguments
$contentManagerData
array
Content manager data from sql query.
Response
array
Prepared content manager data.
Returns the content position of the given query result.
_getContentPosition(array $queryResult) : string
Arguments
$queryResult
array
Data sets of query for content_manager table.
Response
string
Whether "pages_main", "pages_secondary" or "pages_info".
Returns the content type of the given query result.
_getContentType(array $queryResult) : string
inherited
Arguments
$queryResult
array
Data sets of query for content_manager table.
Response
string
Whether "content", "file" or "link".
Renders the creation form for content manager main pages.
_getCreationResponse(string $type) : \AdminLayoutHttpControllerResponse
Returns content manager data to be edited, prepared for the edit form.
_getEditData(integer $contentId, array $contentData) : array
Arguments
$contentId
integer
Content manager tables "content_group" value.
$contentData
array
Raw data set from sql query.
Response
array
Prepared data set array for edit forms of content manager pages.
Fetches and returns the content data for the content manager pages.
_getPagesData() : array
Returns the expected $_POST value by the given key name.
_getPostData(string $keyName) : string|null
inherited
This method is the object oriented layer for $_POST[$keyName].
Arguments
$keyName
string
Expected key of post parameter.
Response
string|null
Either the expected value or null, of not found.
Creates and returns a key value collection which represent the global $_POST array.
_getPostDataCollection() : \KeyValueCollection
inherited
Returns an array with allowed script files for content data.
_getProductsContentFiles() : array
inherited
Response
array
List with allowed script files.
Returns the expected $_GET value by the given key name.
_getQueryParameter(string $keyName) : mixed|null
inherited
This method is the object oriented layer for $_GET[$keyName].
Arguments
$keyName
string
Expected key of query parameter.
Response
mixed|null
Either the expected value or null, of not found.
Creates and returns a key value collection which represent the global $_GET array.
_getQueryParametersCollection() : \KeyValueCollection
inherited
Returns an array with allowed script files for content data.
_getScriptPageFiles() : array
inherited
Response
array
List with allowed script files.
Returns the expected $_SERVER value by the given key name.
_getServerData(string $keyName) : string|null
inherited
This method is the object oriented layer for $_SERVER[$keyName].
Arguments
$keyName
string
Expected key of server parameter.
Response
string|null
Either the expected value or null, of not found.
Returns an existing file object with the path to a content manager template file.
_getTemplate(string $type, string $name) : \ExistingFile
inherited
Take a look on the template files which are located in html/content/content_manager/$type directory
to know possible values for the $name argument.
Arguments
$type
string
Content manager type, whether "pages", "elements" or "product_contents".
$name
string
Name of template file.
Response
\ExistingFile
Whether redirects to the last overview or update pages.
_getUpdateResponse(string $contentManagerType, integer $contentGroupId, $editMethod = 'edit') : \RedirectHttpControllerResponse
inherited
Arguments
$contentManagerType
string
Name of content manager controller class.
$contentGroupId
integer
Content id of last edited content.
Response
\RedirectHttpControllerResponse
Executes an sql query again the url_rewrites table and returns the result.
_getUrlRewriteEditData(integer $contentId) : \UrlRewriteCollection
Arguments
$contentId
integer
Url rewrites table "content_id" value.
Response
\UrlRewriteCollection
Url rewrite collection.
Inserts the given content data in the database.
_insertContentData(\CI_DB_query_builder $queryBuilder, array $contentData) : $this|\ContentManagerPagesController
inherited
Arguments
$queryBuilder
\CI_DB_query_builder
Query builder instance to access the database.
$contentData
array
Content data array.
Response
$this|\ContentManagerPagesController
Same instance for chained method calls.
Returns true if the "Responsive File Manager" is installed an false otherwise.
_isFilemanagerAvailable() : boolean
inherited
Prepares $_POST data for updating or inserting into the content_manager table.
_prepareContentManagerData(integer $contentGroupId, string $contentManagerType) : array
Arguments
$contentGroupId
integer
Content manager tables "content_group" value.
$contentManagerType
string
Whether "infopage", "linkpage" or "scriptpage".
Response
array
Data set for the content_manager table.
Prepares $_POST data for the content_manager's 'group_ids' column.
_prepareContentManagerGroupCheckData() : string
inherited
Prepares $_POST data for updating or inserting into the database.
_prepareData(string $contentManagerType) : array
Arguments
$contentManagerType
string
Whether "infopage", "linkpage" or "scriptpage".
Response
array
Contains data sets for content_manager- and url_rewrites table and an additional content group id.
Prepares $_POST data for content manager link pages.
_prepareLinkPagePostData() : array
Response
array
Prepared data set for updating or inserting into the database.
Renders and returns a template file.
_render(string $templateFile, array $contentArray) : string
inherited
Arguments
$templateFile
string
Template file to render.
$contentArray
array
Content array which represent the variables of the template.
Response
string
Rendered template.
Repairs gm_url_keywords for contents
_repairUrlKeywords() : $this
Response
$this
Same instance for chained method calls.
Sets the expert mode, if the query parameter has been passed.
_setExpertMode()
inherited
Stores the given url rewrites in the database.
_storeUrlRewrites(array $urlRewrites, integer $contentGroupId) : $this|\ContentManagerPagesController
Arguments
$urlRewrites
array
Content data array.
$contentGroupId
integer
Content group id.
Response
$this|\ContentManagerPagesController
Same instance for chained method calls.
Updates the given content data in the database.
_updateContentData(\CI_DB_query_builder $queryBuilder, array $contentData, integer $contentGroupId) : $this|\ContentManagerPagesController
inherited
Arguments
$queryBuilder
\CI_DB_query_builder
Query builder instance to access the database.
$contentData
array
Content data array.
$contentGroupId
integer
Content group id.
Response
$this|\ContentManagerPagesController
Same instance for chained method calls.
Update content slider
_updateSlider(array $data) : $this
Arguments
Response
$this
Same instance for chained method calls.
Check if the $_POST['pageToken'] or $_GET['pageToken'] variable is provided and if it's valid.
_validatePageToken(string $customExceptionMessage = null)
inherited
Example:
public function proceed(HttpContextInterface $httpContext)
{
parent::proceed($httpContext); // proceed http context from parent class
if($_SERVER['REQUEST_METHOD'] === 'POST')
{
$this->_validatePageToken(); // CSRF Protection
}
}
|
|
Throws |
- \Exception
If the validation fails.
|
Arguments
$customExceptionMessage
string
(optional) You can specify a custom exception message.
Renders the creation form for content manager info pages.
actionCreateInfo() : \AdminLayoutHttpControllerResponse
Renders the creation form for content manager info box pages.
actionCreateInfoBox() : \AdminLayoutHttpControllerResponse
Renders the creation form for content manager main pages.
actionCreateMain() : \AdminLayoutHttpControllerResponse
Renders the creation form for content manager secondary pages.
actionCreateSecondary() : \AdminLayoutHttpControllerResponse
Default action method.
actionDefault() : \HttpControllerResponseInterface
inherited
Every controller child class requires at least the default action method, which is invoked when
the ::_getQueryParameterData('do') value is not separated by a trailing slash.
Every action method have to return an instance which implements the http controller response interface.
Response
\HttpControllerResponseInterface
Renders the editing form for content manager pages.
actionEdit() : \AdminLayoutHttpControllerResponse
Stores content manager info page data in the database and redirects to the overview.
actionSaveInfoPage() : \RedirectHttpControllerResponse
Stores content manager link page data in the database and redirects to the overview.
actionSaveLinkPage() : \RedirectHttpControllerResponse
Stores content manager link page data in the database and redirects to the overview.
actionSaveScriptPage() : \RedirectHttpControllerResponse
Updates content manager info pages data in the database and redirects to the overview.
actionUpdateContentPage() : \RedirectHttpControllerResponse
Updates content manager script pages data in the database and redirects to the overview.
actionUpdateFilePage() : \RedirectHttpControllerResponse
Updates content manager link pages data in the database and redirects to the overview.
actionUpdateLinkPage() : \RedirectHttpControllerResponse
Searches the GXModules directory and admin/html directory for a template file,
wich can be useed inside the AdminLayoutHttpControllerResponse object for the template parameter.
getTemplateFile(string $templateFile) : \ExistingFile
inherited
Throws |
- \Exception
if the path or file is not found
|
Arguments
$templateFile
string
The relative path and filename to search for
Response
\ExistingFile
containing absolute file path to the given template file
Initialize Controller
init()
Processes a http response object which is get by invoking an action method.
proceed(\HttpContextInterface $httpContext)
inherited
The action method is determined by the http context reader instance and the current request context.
Re-implement this method in child classes to enable XSS and CSRF protection on demand.
see
|
\HttpContextReaderInterface::getActionName
\HttpResponseProcessorInterface::proceed
|
|
|
Throws |
- \LogicException
When no action method is found by the http context reader.
|
Arguments
Makes sure that the admin status is currently given in session
validateCurrentAdminStatus()
inherited
Properties
userConfigurationService
userConfigurationService : \UserConfigurationService
languageTextManager
languageTextManager : \LanguageTextManager
Type(s)
\LanguageTextManager
languageProvider
languageProvider : \LanguageProvider
queryBuilder
queryBuilder : \CI_DB_query_builder
Type(s)
\CI_DB_query_builder
urlRewriteStorage
urlRewriteStorage : \UrlRewriteStorage
fieldMap
fieldMap : array
switcherFields
switcherFields : array
title
title : \NonEmptyStringType
sliderWriteService
sliderWriteService : \SliderWriteServiceInterface
sliderReadService
sliderReadService : \SliderReadServiceInterface
contentTypeFileFlagMap
contentTypeFileFlagMap : array
inherited
fileTypMap
fileTypMap : array
inherited
isExpertMode
isExpertMode : boolean
inherited
httpContextReader
httpContextReader : \HttpContextReaderInterface
inherited
httpResponseProcessor
httpResponseProcessor : \HttpResponseProcessorInterface
inherited
contentView
contentView : \ContentViewInterface
inherited
queryParametersArray
queryParametersArray : array
inherited
postDataArray
postDataArray : array
inherited
Contain the assets needed to be included in the view HTML.
assets : \AssetCollectionInterface
inherited
Server data.
serverDataArray : array
inherited