|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the TYPO3 CMS project. |
|
5
|
|
|
* |
|
6
|
|
|
* It is free software; you can redistribute it and/or modify it under |
|
7
|
|
|
* the terms of the GNU General Public License, either version 2 |
|
8
|
|
|
* of the License, or any later version. |
|
9
|
|
|
* |
|
10
|
|
|
* For the full copyright and license information, please read the |
|
11
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
12
|
|
|
* |
|
13
|
|
|
* The TYPO3 project - inspiring people to share! |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
namespace TYPO3\CMS\Backend\Controller; |
|
17
|
|
|
|
|
18
|
|
|
use Psr\Http\Message\ResponseInterface; |
|
19
|
|
|
use TYPO3\CMS\Backend\Module\ModuleLoader; |
|
20
|
|
|
use TYPO3\CMS\Backend\Template\ModuleTemplate; |
|
21
|
|
|
use TYPO3\CMS\Core\Http\HtmlResponse; |
|
22
|
|
|
use TYPO3\CMS\Core\Information\Typo3Information; |
|
23
|
|
|
use TYPO3\CMS\Core\Information\Typo3Version; |
|
24
|
|
|
use TYPO3\CMS\Core\Package\PackageManager; |
|
25
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
26
|
|
|
use TYPO3\CMS\Fluid\View\StandaloneView; |
|
27
|
|
|
use TYPO3Fluid\Fluid\View\ViewInterface; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Module 'about' shows some standard information for TYPO3 CMS: |
|
31
|
|
|
* About-text, version number, available modules and so on. |
|
32
|
|
|
* |
|
33
|
|
|
* @internal This is a specific Backend Controller implementation and is not considered part of the Public TYPO3 API. |
|
34
|
|
|
*/ |
|
35
|
|
|
class AboutController |
|
36
|
|
|
{ |
|
37
|
|
|
/** |
|
38
|
|
|
* ModuleTemplate object |
|
39
|
|
|
* |
|
40
|
|
|
* @var ModuleTemplate |
|
41
|
|
|
*/ |
|
42
|
|
|
protected $moduleTemplate; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @var ViewInterface |
|
46
|
|
|
*/ |
|
47
|
|
|
protected $view; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @var Typo3Version |
|
51
|
|
|
*/ |
|
52
|
|
|
protected $version; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @var Typo3Information |
|
56
|
|
|
*/ |
|
57
|
|
|
protected $typo3Information; |
|
58
|
|
|
|
|
59
|
|
|
public function __construct(Typo3Version $version, Typo3Information $typo3Information) |
|
60
|
|
|
{ |
|
61
|
|
|
$this->version = $version; |
|
62
|
|
|
$this->typo3Information = $typo3Information; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Main action: Show standard information |
|
67
|
|
|
* |
|
68
|
|
|
* @return ResponseInterface the HTML output |
|
69
|
|
|
*/ |
|
70
|
|
|
public function indexAction(): ResponseInterface |
|
71
|
|
|
{ |
|
72
|
|
|
$this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class); |
|
73
|
|
|
$this->initializeView('index'); |
|
74
|
|
|
$warnings = []; |
|
75
|
|
|
// Hook for additional warnings |
|
76
|
|
|
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['displayWarningMessages'] ?? [] as $className) { |
|
77
|
|
|
$hookObj = GeneralUtility::makeInstance($className); |
|
78
|
|
|
if (method_exists($hookObj, 'displayWarningMessages_postProcess')) { |
|
79
|
|
|
$hookObj->displayWarningMessages_postProcess($warnings); |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
$this->view->assignMultiple([ |
|
84
|
|
|
'copyrightYear' => $this->typo3Information->getCopyrightYear(), |
|
85
|
|
|
'donationUrl' => $this->typo3Information::URL_DONATE, |
|
86
|
|
|
'currentVersion' => $this->version->getVersion(), |
|
87
|
|
|
'loadedExtensions' => $this->getLoadedExtensions(), |
|
88
|
|
|
'copyRightNotice' => $this->typo3Information->getCopyrightNotice(), |
|
89
|
|
|
'warnings' => $warnings, |
|
90
|
|
|
'modules' => $this->getModulesData() |
|
91
|
|
|
]); |
|
92
|
|
|
|
|
93
|
|
|
$this->moduleTemplate->setContent($this->view->render()); |
|
94
|
|
|
return new HtmlResponse($this->moduleTemplate->renderContent()); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* Create array with data of all main modules (Web, File, ...) |
|
99
|
|
|
* and its nested sub modules |
|
100
|
|
|
* |
|
101
|
|
|
* @return array |
|
102
|
|
|
*/ |
|
103
|
|
|
protected function getModulesData(): array |
|
104
|
|
|
{ |
|
105
|
|
|
$loadedModules = GeneralUtility::makeInstance(ModuleLoader::class); |
|
106
|
|
|
$loadedModules->observeWorkspaces = true; |
|
107
|
|
|
$loadedModules->load($GLOBALS['TBE_MODULES']); |
|
108
|
|
|
$mainModulesData = []; |
|
109
|
|
|
foreach ($loadedModules->modules as $moduleName => $moduleInfo) { |
|
110
|
|
|
$moduleLabels = $loadedModules->getLabelsForModule($moduleName); |
|
111
|
|
|
$mainModuleData = [ |
|
112
|
|
|
'name' => $moduleName, |
|
113
|
|
|
'label' => $moduleLabels['title'] |
|
114
|
|
|
]; |
|
115
|
|
|
if (is_array($moduleInfo['sub']) && !empty($moduleInfo['sub'])) { |
|
116
|
|
|
$mainModuleData['subModules'] = $this->getSubModuleData($loadedModules, $moduleName); |
|
117
|
|
|
} |
|
118
|
|
|
$mainModulesData[] = $mainModuleData; |
|
119
|
|
|
} |
|
120
|
|
|
return $mainModulesData; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* Create array with data of all subModules of a specific main module |
|
125
|
|
|
* |
|
126
|
|
|
* @param ModuleLoader $loadedModules the module loader instance |
|
127
|
|
|
* @param string $moduleName Name of the main module |
|
128
|
|
|
* @return array |
|
129
|
|
|
*/ |
|
130
|
|
|
protected function getSubModuleData(ModuleLoader $loadedModules, $moduleName): array |
|
131
|
|
|
{ |
|
132
|
|
|
if (empty($loadedModules->modules[$moduleName]['sub'])) { |
|
133
|
|
|
return []; |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
$subModulesData = []; |
|
137
|
|
|
foreach ($loadedModules->modules[$moduleName]['sub'] as $subModuleName => $subModuleInfo) { |
|
138
|
|
|
$moduleLabels = $loadedModules->getLabelsForModule($moduleName . '_' . $subModuleName); |
|
139
|
|
|
$subModuleData = []; |
|
140
|
|
|
$subModuleData['name'] = $subModuleName; |
|
141
|
|
|
$subModuleData['icon'] = $subModuleInfo['icon'] ?? null; |
|
142
|
|
|
$subModuleData['iconIdentifier'] = $subModuleInfo['iconIdentifier'] ?? null; |
|
143
|
|
|
$subModuleData['label'] = $moduleLabels['title'] ?? null; |
|
144
|
|
|
$subModuleData['shortDescription'] = $moduleLabels['shortdescription'] ?? null; |
|
145
|
|
|
$subModuleData['longDescription'] = $moduleLabels['description'] ?? null; |
|
146
|
|
|
$subModulesData[] = $subModuleData; |
|
147
|
|
|
} |
|
148
|
|
|
return $subModulesData; |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
/** |
|
152
|
|
|
* Fetches a list of all active (loaded) extensions in the current system |
|
153
|
|
|
* |
|
154
|
|
|
* @return array |
|
155
|
|
|
*/ |
|
156
|
|
|
protected function getLoadedExtensions(): array |
|
157
|
|
|
{ |
|
158
|
|
|
$extensions = []; |
|
159
|
|
|
$packageManager = GeneralUtility::makeInstance(PackageManager::class); |
|
160
|
|
|
foreach ($packageManager->getActivePackages() as $package) { |
|
161
|
|
|
// Skip system extensions (= type: typo3-cms-framework) |
|
162
|
|
|
if ($package->getValueFromComposerManifest('type') !== 'typo3-cms-extension') { |
|
163
|
|
|
continue; |
|
164
|
|
|
} |
|
165
|
|
|
$extensions[] = [ |
|
166
|
|
|
'key' => $package->getPackageKey(), |
|
167
|
|
|
'title' => $package->getPackageMetaData()->getDescription(), |
|
168
|
|
|
'authors' => $package->getValueFromComposerManifest('authors') |
|
169
|
|
|
]; |
|
170
|
|
|
} |
|
171
|
|
|
return $extensions; |
|
172
|
|
|
} |
|
173
|
|
|
|
|
174
|
|
|
/** |
|
175
|
|
|
* Initializes the view by setting the templateName |
|
176
|
|
|
* |
|
177
|
|
|
* @param string $templateName |
|
178
|
|
|
*/ |
|
179
|
|
|
protected function initializeView(string $templateName) |
|
180
|
|
|
{ |
|
181
|
|
|
$this->view = GeneralUtility::makeInstance(StandaloneView::class); |
|
182
|
|
|
$this->view->setTemplate($templateName); |
|
183
|
|
|
$this->view->setTemplateRootPaths(['EXT:backend/Resources/Private/Templates/About']); |
|
184
|
|
|
$this->view->setPartialRootPaths(['EXT:backend/Resources/Private/Partials/About']); |
|
185
|
|
|
$this->view->setLayoutRootPaths(['EXT:backend/Resources/Private/Layouts']); |
|
186
|
|
|
} |
|
187
|
|
|
} |
|
188
|
|
|
|