92 $configuration = $this->configurationManager->getConfiguration(\
TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
93 if (empty($configuration[
'extensionName'])) {
94 throw new \TYPO3\CMS\Extbase\Mvc\Exception(
'"extensionName" is not properly configured. Request can\'t be dispatched!', 1289843275);
96 if (empty($configuration[
'pluginName'])) {
97 throw new \TYPO3\CMS\Extbase\Mvc\Exception(
'"pluginName" is not properly configured. Request can\'t be dispatched!', 1289843277);
99 if (!empty($configuration[
'vendorName'])) {
100 $this->vendorName = $configuration[
'vendorName'];
102 $this->vendorName = NULL;
104 $this->extensionName = $configuration[
'extensionName'];
105 $this->pluginName = $configuration[
'pluginName'];
106 $this->defaultControllerName = current(array_keys($configuration[
'controllerConfiguration']));
107 $this->allowedControllerActions = array();
108 foreach ($configuration[
'controllerConfiguration'] as $controllerName => $controllerActions) {
109 $this->allowedControllerActions[$controllerName] = $controllerActions[
'actions'];
111 if (!empty($configuration[
'format'])) {
112 $this->defaultFormat = $configuration[
'format'];
121 public function build() {
123 $pluginNamespace = $this->extensionService->getPluginNamespace($this->extensionName, $this->pluginName);
126 if (isset($files[$pluginNamespace]) && is_array($files[$pluginNamespace])) {
132 $request = $this->objectManager->get(
'TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request');
133 if ($this->vendorName !== NULL) {
134 $request->setControllerVendorName($this->vendorName);
136 $request->setPluginName($this->pluginName);
137 $request->setControllerExtensionName($this->extensionName);
138 $request->setControllerName($controllerName);
139 $request->setControllerActionName($actionName);
140 $request->setRequestUri(\
TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv(
'TYPO3_REQUEST_URL'));
141 $request->setBaseUri(\
TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv(
'TYPO3_SITE_URL'));
142 $request->setMethod($this->environmentService->getServerRequestMethod());
144 $request->setFormat(filter_var(
$parameters[
'format'], FILTER_SANITIZE_STRING));
146 $request->setFormat($this->defaultFormat);
148 foreach (
$parameters as $argumentName => $argumentValue) {
149 $request->setArgument($argumentName, $argumentValue);
166 if (!isset($parameters[
'controller']) || strlen($parameters[
'controller']) === 0) {
167 if (strlen($this->defaultControllerName) === 0) {
168 throw new \TYPO3\CMS\Extbase\Mvc\Exception(
'The default controller for extension "' . $this->extensionName .
'" and plugin "' . $this->pluginName .
'" can not be determined. Please check for TYPO3\\CMS\\Extbase\\Utility\\ExtensionUtility::configurePlugin() in your ext_localconf.php.', 1316104317);
172 $allowedControllerNames = array_keys($this->allowedControllerActions);
173 if (!in_array($parameters[
'controller'], $allowedControllerNames)) {
174 $configuration = $this->configurationManager->getConfiguration(\
TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
175 if (isset($configuration[
'mvc'][
'throwPageNotFoundExceptionIfActionCantBeResolved']) && (
boolean) $configuration[
'mvc'][
'throwPageNotFoundExceptionIfActionCantBeResolved']) {
176 throw new \TYPO3\CMS\Core\Error\Http\PageNotFoundException(
'The requested resource was not found', 1313857897);
177 } elseif (isset($configuration[
'mvc'][
'callDefaultActionIfActionCantBeResolved']) && (
boolean) $configuration[
'mvc'][
'callDefaultActionIfActionCantBeResolved']) {
180 throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidControllerNameException(
'The controller "' . $parameters[
'controller'] .
'" is not allowed by this plugin. Please check for TYPO3\\CMS\\Extbase\\Utility\\ExtensionUtility::configurePlugin() in your ext_localconf.php.', 1313855173);
182 return filter_var($parameters[
'controller'], FILTER_SANITIZE_STRING);
198 $defaultActionName = is_array($this->allowedControllerActions[$controllerName]) ? current($this->allowedControllerActions[$controllerName]) :
'';
199 if (!isset($parameters[
'action']) || strlen($parameters[
'action']) === 0) {
200 if (strlen($defaultActionName) === 0) {
201 throw new \TYPO3\CMS\Extbase\Mvc\Exception(
'The default action can not be determined for controller "' . $controllerName .
'". Please check TYPO3\\CMS\\Extbase\\Utility\\ExtensionUtility::configurePlugin() in your ext_localconf.php.', 1295479651);
203 return $defaultActionName;
205 $actionName = $parameters[
'action'];
206 $allowedActionNames = $this->allowedControllerActions[$controllerName];
207 if (!in_array($actionName, $allowedActionNames)) {
208 $configuration = $this->configurationManager->getConfiguration(\
TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
209 if (isset($configuration[
'mvc'][
'throwPageNotFoundExceptionIfActionCantBeResolved']) && (
boolean) $configuration[
'mvc'][
'throwPageNotFoundExceptionIfActionCantBeResolved']) {
210 throw new \TYPO3\CMS\Core\Error\Http\PageNotFoundException(
'The requested resource was not found', 1313857898);
211 } elseif (isset($configuration[
'mvc'][
'callDefaultActionIfActionCantBeResolved']) && (
boolean) $configuration[
'mvc'][
'callDefaultActionIfActionCantBeResolved']) {
212 return $defaultActionName;
214 throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidActionNameException(
'The action "' . $actionName .
'" (controller "' . $controllerName .
'") is not allowed by this plugin. Please check TYPO3\\CMS\\Extbase\\Utility\\ExtensionUtility::configurePlugin() in your ext_localconf.php.', 1313855175);
216 return filter_var($actionName, FILTER_SANITIZE_STRING);
227 $untangledFiles = array();
228 $fieldPaths = array();
229 foreach ($convolutedFiles as $firstLevelFieldName => $fieldInformation) {
230 if (!is_array($fieldInformation[
'error'])) {
231 $fieldPaths[] = array($firstLevelFieldName);
233 $newFieldPaths = $this->
calculateFieldPaths($fieldInformation[
'error'], $firstLevelFieldName);
234 array_walk($newFieldPaths,
function (&$value, $key) {
235 $value = explode(
'/', $value);
237 $fieldPaths = array_merge($fieldPaths, $newFieldPaths);
240 foreach ($fieldPaths as $fieldPath) {
241 if (count($fieldPath) === 1) {
242 $fileInformation = $convolutedFiles[$fieldPath[0]];
244 $fileInformation = array();
245 foreach ($convolutedFiles[$fieldPath[0]] as $key => $subStructure) {
251 return $untangledFiles;
262 $fieldPaths = array();
263 if (is_array($structure)) {
264 foreach ($structure as $key => $subStructure) {
265 $fieldPath = ($firstLevelFieldName !== NULL ? $firstLevelFieldName .
'/' :
'') . $key;
266 if (is_array($subStructure)) {
268 $fieldPaths[] = $fieldPath .
'/' . $subFieldPath;
271 $fieldPaths[] = $fieldPath;
resolveActionName($controllerName, array $parameters)
calculateFieldPaths(array $structure, $firstLevelFieldName=NULL)
resolveControllerName(array $parameters)
untangleFilesArray(array $convolutedFiles)
static arrayMergeRecursiveOverrule(array $firstArray, array $secondArray, $dontAddNewKeys=FALSE, $emptyValuesOverride=TRUE)
$allowedControllerActions
static setValueByPath($subject, $path, $value)
static getValueByPath(array &$array, $path)
static _GPmerged($parameter)