ComponentController
extends SystemComponentController
in package
implements
JsonAdapter
Main controller for Net Manager
Tags
Table of Contents
Interfaces
- JsonAdapter
- JSON Adapter for JSON requests
Constants
- BLACKLISTED_DOMAINS = ['10minmail.de', '10minutenmail.xyz', 'bluewin.ch', 'bossmail.de', 'candymail.de', 'cloudrexx.at', 'cloudrexx.ch', 'cloudrexx.com', 'cloudrexx.de', 'contrexx.com', 'doublemail.de', 'dsgvo.party', 'example.com', 'example.org', 'existiert.net', 'fake-box.com', 'fliegender.fish', 'fn.de', 'freenet.de', 'freenetmail.de', 'fukaru.com', 'funnymail.de', 'gmail.com', 'gmx.at', 'gmx.biz', 'gmx.ch', 'gmx.com', 'gmx.de', 'gmx.eu', 'gmx.info', 'gmx.net', 'gmx.org', 'gmx.tm', 'hispeed.ch', 'hotmail.com', 'jaga.email', 'ji5.de', 'ji6.de', 'ji7.de', 'justmail.de', 'knickerbockerban.de', 'lambsauce.de', 'live.com', 'magenta.de', 'magspam.net', 'mail.de', 'mdz.email', 'muell.icu', 'muell.io', 'muell.monster', 'muell.xyz', 'muellemail.com', 'muellmail.com', 'oida.icu', 'opentrash.com', 'outlook.com', 'papierkorb.me', 'puppetmail.de', 'ramenmail.de', 're-gister.com', 'spam.care', 'spoofmail.de', 'spoofmail.es', 'spoofmail.fr', 'sudern.de', 't-online.de', 'tonne.to', 'trash-mail.com', 'trash-me.com', 'ultra.fyi', 'web.de', 'wegwerfemail.de', 'yahoo.com', 'you-spam.com']
- List of domains that are prohibitted from using as sender domains
Properties
- $config : array<string|int, mixed>
- Config loaded from YAML
- $cx : Cx
- Main class instance
- $developerDocumentationUrl : string
- URL pointing to the developer documentation for this component
- $enduserDocumentationUrl : string
- URL pointing to the end-user documentation for this component
- $systemComponent : SystemComponent
- Decorated SystemComponent
- $templateDocumentationUrl : string
- URL pointing to the template definitions for this component
- $trackedSenderDomainNames : array<string|int, mixed>
Methods
- __call() : mixed
- Decoration: all methods that are not specified in this or child classes call the corresponding method of the decorated SystemComponent
- __construct() : mixed
- Initializes a controller
- addCacheMetaDataToEntry() : void
- Adds 'validUntil' and 'cachedAt' indexes to $entry which are then used by {@see \Cx\Core_Modules\Cache\Controller\ComponentController::getCachefileData()} to determine its expiration.
- addTrackedSenderDomain() : array<string|int, mixed>
- JSON Adapter to add a domain to the list of tracked sender domains
- adjustResponse() : mixed
- Do something with a Response object You may do page alterations here (like changing the metatitle) You may do response alterations here (like set headers) PLEASE MAKE SURE THIS METHOD IS MOCKABLE. IT MAY ONLY INTERACT WITH resolve() HOOK.
- executeCommand() : void
- Execute one of the commands listed in getCommandsForCommandMode()
- getAccessableMethods() : array<string|int, mixed>
- Returns an array of method names accessable from a JSON request
- getCommandDescription() : string
- Returns the description for a command provided by this component
- getCommandsForCommandMode() : array<string|int, mixed>
- Returns a list of command mode commands provided by this component
- getComponent() : SystemComponentController
- Get component controller object
- getConfigValue() : string
- Returns a value from the config tree
- getConfigValues() : array<string|int, mixed>
- Returns part of the config tree
- getController() : Controller
- Returns a controller instance if one already exists
- getControllerClasses() : array<string|int, mixed>
- Get the Controller classes
- getControllers() : array<string|int, mixed>
- Returns a list of controllers
- getControllersAccessableByJson() : array<string|int, mixed>
- Returns a list of JsonAdapter class names
- getDefaultPermissions() : object
- Returns default permission as object
- getDeveloperDocumentationUrl() : string
- Returns the URL pointing to the developer documentation of this component.
- getDomainMailComplianceDetails() : array<string|int, mixed>
- Gets the compliance info for a given domain
- getEnduserDocumentationUrl() : string
- Returns the URL pointing to the end-user documentation for this component.
- getMessagesAsString() : string
- Returns all messages as string
- getName() : string
- Returns the internal name used as identifier for this adapter
- getSystemComponent() : SystemComponent
- Returns the SystemComponent this Controller decorates
- getSystemComponentController() : SystemComponentController
- Returns the main controller
- getTemplateDocumentationUrl() : string
- Returns the URL pointing to the template documentation for this component.
- getTrackedSenderDomains() : DataSet
- Loads the list of tracked sender domains
- hasAccessToExecuteCommand() : bool
- Check whether the command has access to execute or not.
- isBlacklistedDomain() : bool
- Check if a domain is on the blacklist
- load() : mixed
- Load your component. It is needed for this request.
- loadMailComplicanceDetails() : array<string|int, mixed>
- Loads the mail compliance details for a domain
- postComponentLoad() : mixed
- Do something after all active components are loaded USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE.
- postContentLoad() : mixed
- Do something after content is loaded from DB
- postContentParse() : mixed
- Do something after a module is loaded
- postFinalize() : mixed
- Do something after main template got parsed
- postInit() : mixed
- Do something after system initialization
- postResolve() : mixed
- Do something after resolving is done
- preComponentLoad() : mixed
- Do something before component load * USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE.
- preContentLoad() : mixed
- Do something before content is loaded from DB
- preContentParse() : mixed
- Do something before a module is loaded
- preFinalize() : mixed
- Do something before main template gets parsed
- preInit() : mixed
- Do something before system initialization
- preResolve() : mixed
- Do something before resolving is done
- refreshDnsRecords() : void
- Refreshes the DNS and mail compliance info for the given method
- registerController() : null
- Registers a controller instance
- registerEventListeners() : mixed
- Register your event listeners here
- registerEvents() : mixed
- Register your events here
- removeTrackedSenderDomain() : void
- JSON Adapter to remove a domain from the list of tracked sender domains
- resolve() : mixed
- Called for additional, component specific resolving
- setSystemComponent() : SystemComponent
- Sets the SystemComponent this Controller decorates
- addOrRemoveTrackedSenderDomain() : void
- Adds or removes a domain from the list of tracked sender domains
- adjustFullyQualifiedClassName() : string
- This makes sure a FQCN does not contain double backslashes
- getControllerClassName() : string
- This finds the correct FQCN for a controller name
- isDkimValid() : bool
- Validates a DKIM DNS record against a DKIM private key.
- isDmarcValid() : bool
- isSpfValid() : bool
- loadConfigFile() : array<string|int, mixed>
- Loads a config YAML file
- loadData() : void
- Load data from Component.yml
- loadTrackedSenderDomainNames() : void
- Load tracked sender domain names
Constants
BLACKLISTED_DOMAINS
List of domains that are prohibitted from using as sender domains
protected
array<string|int, mixed>
BLACKLISTED_DOMAINS
= ['10minmail.de', '10minutenmail.xyz', 'bluewin.ch', 'bossmail.de', 'candymail.de', 'cloudrexx.at', 'cloudrexx.ch', 'cloudrexx.com', 'cloudrexx.de', 'contrexx.com', 'doublemail.de', 'dsgvo.party', 'example.com', 'example.org', 'existiert.net', 'fake-box.com', 'fliegender.fish', 'fn.de', 'freenet.de', 'freenetmail.de', 'fukaru.com', 'funnymail.de', 'gmail.com', 'gmx.at', 'gmx.biz', 'gmx.ch', 'gmx.com', 'gmx.de', 'gmx.eu', 'gmx.info', 'gmx.net', 'gmx.org', 'gmx.tm', 'hispeed.ch', 'hotmail.com', 'jaga.email', 'ji5.de', 'ji6.de', 'ji7.de', 'justmail.de', 'knickerbockerban.de', 'lambsauce.de', 'live.com', 'magenta.de', 'magspam.net', 'mail.de', 'mdz.email', 'muell.icu', 'muell.io', 'muell.monster', 'muell.xyz', 'muellemail.com', 'muellmail.com', 'oida.icu', 'opentrash.com', 'outlook.com', 'papierkorb.me', 'puppetmail.de', 'ramenmail.de', 're-gister.com', 'spam.care', 'spoofmail.de', 'spoofmail.es', 'spoofmail.fr', 'sudern.de', 't-online.de', 'tonne.to', 'trash-mail.com', 'trash-me.com', 'ultra.fyi', 'web.de', 'wegwerfemail.de', 'yahoo.com', 'you-spam.com']
Properties
$config
Config loaded from YAML
protected
array<string|int, mixed>
$config
= array()
Tree of configs
$cx
Main class instance
protected
Cx
$cx
= null
$developerDocumentationUrl
URL pointing to the developer documentation for this component
protected
string
$developerDocumentationUrl
= ''
Developer documentation URL
$enduserDocumentationUrl
URL pointing to the end-user documentation for this component
protected
string
$enduserDocumentationUrl
= ''
End-user documentation URL
$systemComponent
Decorated SystemComponent
protected
SystemComponent
$systemComponent
$templateDocumentationUrl
URL pointing to the template definitions for this component
protected
string
$templateDocumentationUrl
= ''
Template documentation URL
$trackedSenderDomainNames
protected
array<string|int, mixed>
$trackedSenderDomainNames
= array()
Cached list of names of tracked sender domains
Methods
__call()
Decoration: all methods that are not specified in this or child classes call the corresponding method of the decorated SystemComponent
public
__call(string $methodName, array<string|int, mixed> $arguments) : mixed
Parameters
- $methodName : string
-
Name of method to call
- $arguments : array<string|int, mixed>
-
List of arguments for the method to call
Attributes
- #[ReturnTypeWillChange]
Return values
mixed —Return value of the method to call
__construct()
Initializes a controller
public
__construct(SystemComponent $systemComponent, Cx $cx) : mixed
Parameters
- $systemComponent : SystemComponent
-
SystemComponent to decorate
- $cx : Cx
-
The Cloudrexx main class
addCacheMetaDataToEntry()
Adds 'validUntil' and 'cachedAt' indexes to $entry which are then used by {@see \Cx\Core_Modules\Cache\Controller\ComponentController::getCachefileData()} to determine its expiration.
public
addCacheMetaDataToEntry(array<string|int, mixed> &$entry) : void
Parameters
- $entry : array<string|int, mixed>
-
Entry to add cache meta data to.
addTrackedSenderDomain()
JSON Adapter to add a domain to the list of tracked sender domains
public
addTrackedSenderDomain(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>
-
GET param "domain" needs to be set to an untracked domain
Tags
Return values
array<string|int, mixed> —Array with the key "url" set to the detail page URL for the new domain
adjustResponse()
Do something with a Response object You may do page alterations here (like changing the metatitle) You may do response alterations here (like set headers) PLEASE MAKE SURE THIS METHOD IS MOCKABLE. IT MAY ONLY INTERACT WITH resolve() HOOK.
public
adjustResponse(Response $response) : mixed
Parameters
- $response : Response
-
Response object to adjust
Tags
executeCommand()
Execute one of the commands listed in getCommandsForCommandMode()
public
executeCommand(mixed $command, mixed $arguments[, mixed $dataArguments = array() ]) : void
Parameters
- $command : mixed
-
Name of command to execute
- $arguments : mixed
-
List of arguments for the command
- $dataArguments : mixed = array()
-
(optional) List of data arguments for the command
Tags
getAccessableMethods()
Returns an array of method names accessable from a JSON request
public
getAccessableMethods() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —List of method names
getCommandDescription()
Returns the description for a command provided by this component
public
getCommandDescription(mixed $command[, mixed $short = false ]) : string
Parameters
- $command : mixed
-
The name of the command to fetch the description from
- $short : mixed = false
-
Wheter to return short or long description
Tags
Return values
string —Command description
getCommandsForCommandMode()
Returns a list of command mode commands provided by this component
public
getCommandsForCommandMode() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —List of command names
getComponent()
Get component controller object
public
getComponent(string $name) : SystemComponentController
Parameters
- $name : string
-
component name
Return values
SystemComponentController —The requested component controller or null if no such component exists
getConfigValue()
Returns a value from the config tree
public
getConfigValue(string $key) : string
Parameters
- $key : string
-
Slash-separated path to requested branch
Tags
Return values
string —Requested value as string
getConfigValues()
Returns part of the config tree
public
getConfigValues(string $key) : array<string|int, mixed>
Parameters
- $key : string
-
Slash-separated path to requested branch
Tags
Return values
array<string|int, mixed> —Requested values
getController()
Returns a controller instance if one already exists
public
getController(mixed $controllerClass) : Controller
Parameters
- $controllerClass : mixed
-
Short or FQCN controller name
Tags
Return values
Controller —Controller instance
getControllerClasses()
Get the Controller classes
public
getControllerClasses() : array<string|int, mixed>
Return values
array<string|int, mixed> —name of the controller classes
getControllers()
Returns a list of controllers
public
getControllers([bool $loadedOnly = true ]) : array<string|int, mixed>
Parameters
- $loadedOnly : bool = true
-
(optional) If false, controller that did not register are instanciated, default true
Return values
array<string|int, mixed> —List of Controller instances
getControllersAccessableByJson()
Returns a list of JsonAdapter class names
public
getControllersAccessableByJson() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —List of ComponentController classes
getDefaultPermissions()
Returns default permission as object
public
getDefaultPermissions() : object
Tags
Return values
objectgetDeveloperDocumentationUrl()
Returns the URL pointing to the developer documentation of this component.
public
getDeveloperDocumentationUrl() : string
Return values
string —URL pointing to the developer documentation
getDomainMailComplianceDetails()
Gets the compliance info for a given domain
public
getDomainMailComplianceDetails(string $domainName) : array<string|int, mixed>
Parameters
- $domainName : string
-
Name of domain to get info for
Return values
array<string|int, mixed> —List of domain info
getEnduserDocumentationUrl()
Returns the URL pointing to the end-user documentation for this component.
public
getEnduserDocumentationUrl() : string
Return values
string —URL pointing to the end-user documentation or empty string
getMessagesAsString()
Returns all messages as string
public
getMessagesAsString() : string
Tags
Return values
string —HTML encoded error messages
getName()
Returns the internal name used as identifier for this adapter
public
getName() : string
Return values
string —Name of this adapter
getSystemComponent()
Returns the SystemComponent this Controller decorates
public
getSystemComponent() : SystemComponent
Return values
SystemComponentgetSystemComponentController()
Returns the main controller
public
getSystemComponentController() : SystemComponentController
Return values
SystemComponentController —Main controller for this system component
getTemplateDocumentationUrl()
Returns the URL pointing to the template documentation for this component.
public
getTemplateDocumentationUrl() : string
Return values
string —URL pointing to the template documentation or empty string
getTrackedSenderDomains()
Loads the list of tracked sender domains
public
getTrackedSenderDomains([array<string|int, mixed> $domainsToRefreshDnsOf = array() ][, bool $forceReload = false ]) : DataSet
Regarding caching options: Set $domainsToRefreshDnsOf to a list of domains you want to update DNS data of. Keep in mind, that this may take some time as uncached DNS is quite slow. $forceReload should not be necessary and is only there for debugging purposes. Therefore this is deprecated.
Parameters
- $domainsToRefreshDnsOf : array<string|int, mixed> = array()
-
(optional) List of domain names to ignore DNS cache for
- $forceReload : bool = false
-
(deprecated, optional) If set to true, list of domains is not loaded from cache
Tags
Return values
DataSet —List of tracked sender domains
hasAccessToExecuteCommand()
Check whether the command has access to execute or not.
public
hasAccessToExecuteCommand(string $command, array<string|int, mixed> $arguments) : bool
Parameters
- $command : string
-
name of the command to execute
- $arguments : array<string|int, mixed>
-
list of arguments for the command
Return values
boolisBlacklistedDomain()
Check if a domain is on the blacklist
public
isBlacklistedDomain(string $domain) : bool
A domain that is on the blacklist must not be used as sender domain
Parameters
- $domain : string
-
Domain to check against blacklist
Return values
bool —Whether the domain is blacklisted or not
load()
Load your component. It is needed for this request.
public
load(Page $page) : mixed
This loads your FrontendController or BackendController depending on the mode Cx runs in. For modes other than frontend and backend, nothing is done. If you you'd like to name your Controllers differently, or have another use case, overwrite this.
Parameters
- $page : Page
-
The resolved page
loadMailComplicanceDetails()
Loads the mail compliance details for a domain
public
loadMailComplicanceDetails(string $domainName[, bool $skipCache = false ]) : array<string|int, mixed>
Note: While getDomainMailComplianceDetails() loads all info of a tracked sender domain this only returns the uncached mail compliance details.
Parameters
- $domainName : string
-
Name of the domain to get info for
- $skipCache : bool = false
-
(optional) If set to true DNS cache is not used
Return values
array<string|int, mixed>postComponentLoad()
Do something after all active components are loaded USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE.
public
postComponentLoad() : mixed
postContentLoad()
Do something after content is loaded from DB
public
postContentLoad(Page $page) : mixed
USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE
Parameters
- $page : Page
-
The resolved page
postContentParse()
Do something after a module is loaded
public
postContentParse(Page $page) : mixed
This method is called only if any module gets loaded for content parsing USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE
Parameters
- $page : Page
-
The resolved page
postFinalize()
Do something after main template got parsed
public
postFinalize(string &$endcode) : mixed
USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE!
Parameters
- $endcode : string
-
The processed data to be sent to the client as response
postInit()
Do something after system initialization
public
postInit(Cx $cx) : mixed
USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE. This event must be registered in the postInit-Hook definition file config/postInitHooks.yml.
Parameters
- $cx : Cx
-
The instance of \Cx\Core\Core\Controller\Cx
postResolve()
Do something after resolving is done
public
postResolve(Page $page) : mixed
USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE
Parameters
- $page : Page
-
The resolved page
preComponentLoad()
Do something before component load * USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE.
public
preComponentLoad() : mixed
This event must be registered in the preComponentLoad-Hook definition file config/preComponentLoadHooks.yml.
preContentLoad()
Do something before content is loaded from DB
public
preContentLoad(Page $page) : mixed
USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE
Parameters
- $page : Page
-
The resolved page
preContentParse()
Do something before a module is loaded
public
preContentParse(Page $page) : mixed
This method is called only if any module gets loaded for content parsing USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE
Parameters
- $page : Page
-
The resolved page
preFinalize()
Do something before main template gets parsed
public
preFinalize(Sigma $template) : mixed
USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE
Parameters
- $template : Sigma
-
The main template
preInit()
Do something before system initialization
public
preInit(Cx $cx) : mixed
USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE. This event must be registered in the preInit-Hook definition file config/preInitHooks.yml.
Parameters
- $cx : Cx
-
The instance of \Cx\Core\Core\Controller\Cx
preResolve()
Do something before resolving is done
public
preResolve(Url $request) : mixed
USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE
Parameters
- $request : Url
-
The URL object for this request
refreshDnsRecords()
Refreshes the DNS and mail compliance info for the given method
public
refreshDnsRecords(array<string|int, mixed> $params) : void
Parameters
- $params : array<string|int, mixed>
registerController()
Registers a controller instance
public
registerController(Controller $controller) : null
Parameters
- $controller : Controller
-
Controller to register
Return values
nullregisterEventListeners()
Register your event listeners here
public
registerEventListeners() : mixed
Tags
registerEvents()
Register your events here
public
registerEvents() : mixed
Tags
removeTrackedSenderDomain()
JSON Adapter to remove a domain from the list of tracked sender domains
public
removeTrackedSenderDomain(array<string|int, mixed> $params) : void
Parameters
- $params : array<string|int, mixed>
-
GET param "domain" needs to be set to a tracked domain
Tags
resolve()
Called for additional, component specific resolving
public
resolve(array<string|int, mixed> $parts, Page $page) : mixed
If /en/Path/to/Page is the path to a page for this component a request like /en/Path/to/Page/with/some/parameters will give an array like array('with', 'some', 'parameters') for $parts PLEASE MAKE SURE THIS METHOD IS MOCKABLE. IT MAY ONLY INTERACT WITH adjustResponse() HOOK.
This may be used to redirect to another page
Parameters
- $parts : array<string|int, mixed>
-
List of additional path parts
- $page : Page
-
Resolved virtual page
setSystemComponent()
Sets the SystemComponent this Controller decorates
public
setSystemComponent(mixed $systemComponent) : SystemComponent
Parameters
- $systemComponent : mixed
Return values
SystemComponentaddOrRemoveTrackedSenderDomain()
Adds or removes a domain from the list of tracked sender domains
protected
addOrRemoveTrackedSenderDomain(string $domainName, bool $add) : void
Parameters
- $domainName : string
-
Name of the domain to add/remove
- $add : bool
-
Set to true to add, false to remove
Tags
adjustFullyQualifiedClassName()
This makes sure a FQCN does not contain double backslashes
protected
adjustFullyQualifiedClassName(string $className) : string
Parameters
- $className : string
-
FQCN of a controller
Return values
string —Clean FQCN of a controller
getControllerClassName()
This finds the correct FQCN for a controller name
protected
getControllerClassName(string $controllerClassShort) : string
Parameters
- $controllerClassShort : string
-
Short name for controller
Return values
string —Fully qualified controller class name
isDkimValid()
Validates a DKIM DNS record against a DKIM private key.
protected
isDkimValid(array<string|int, mixed> $dnsRecords) : bool
Parameters
- $dnsRecords : array<string|int, mixed>
Return values
bool —True if the DNS record matches the private key, false otherwise.
isDmarcValid()
protected
isDmarcValid(string $dmarc) : bool
Parameters
- $dmarc : string
Return values
boolisSpfValid()
protected
isSpfValid(string $domain, string $spf) : bool
Parameters
- $domain : string
- $spf : string
Tags
Return values
boolloadConfigFile()
Loads a config YAML file
protected
loadConfigFile(string $filename) : array<string|int, mixed>
Parameters
- $filename : string
-
Name of the file to load
Tags
Return values
array<string|int, mixed> —Loaded data
loadData()
Load data from Component.yml
protected
loadData() : void
Tags
loadTrackedSenderDomainNames()
Load tracked sender domain names
protected
loadTrackedSenderDomainNames() : void
This loads the list of domains being used as sender domains from the setting trackedSenderDomains and puts it into $this->trackedSenderDomainNames.