@@ 67-81 (lines=15) @@ | ||
64 | ||
65 | foreach ($actions as $key => $action) { |
|
66 | // Check if the view file exists |
|
67 | if ($injectTemplate && $action['view'] == 'twig') { |
|
68 | $injectTwig = true; |
|
69 | $importHtmlResponse = true; |
|
70 | $twigFile = ltrim($action['twigFile'], '/\\'); |
|
71 | ||
72 | $viewDirName = ROOT_PATH.'../../../'.dirname($twigFile); |
|
73 | $result = $this->createDirectory($viewDirName); |
|
74 | if (!$result) { |
|
75 | $errors['actions'][$key]['twigTemplateFileError'] = 'Unable to create directory "'.$viewDirName.'"'; |
|
76 | } |
|
77 | ||
78 | if (file_exists(ROOT_PATH.'../../../'.$twigFile)) { |
|
79 | $errors['actions'][$key]['twigTemplateFileError'] = 'This file already exists.'; |
|
80 | } |
|
81 | } |
|
82 | if ($injectTemplate && $action['view'] == 'php') { |
|
83 | $importHtmlResponse = true; |
|
84 | ||
@@ 82-96 (lines=15) @@ | ||
79 | $errors['actions'][$key]['twigTemplateFileError'] = 'This file already exists.'; |
|
80 | } |
|
81 | } |
|
82 | if ($injectTemplate && $action['view'] == 'php') { |
|
83 | $importHtmlResponse = true; |
|
84 | ||
85 | $phpFile = ltrim($action['phpFile'], '/\\'); |
|
86 | ||
87 | $viewDirName = ROOT_PATH.'../../../'.dirname($phpFile); |
|
88 | $result = $this->createDirectory($viewDirName); |
|
89 | if (!$result) { |
|
90 | $errors['actions'][$key]['phpTemplateFileError'] = 'Unable to create directory "'.$viewDirName.'"'; |
|
91 | } |
|
92 | ||
93 | if (file_exists(ROOT_PATH.'../../../'.$phpFile)) { |
|
94 | $errors['actions'][$key]['phpTemplateFileError'] = 'This file already exists.'; |
|
95 | } |
|
96 | } |
|
97 | if ($action['view'] == 'redirect') { |
|
98 | if (!isset($action['redirect']) || empty($action['redirect'])) { |
|
99 | $errors['actions'][$key]['redirectError'] = 'Redirection URL cannot be empty.'; |