TYPO3 CMS  TYPO3_6-2
ExtensionStatus.php
Go to the documentation of this file.
1 <?php
3 
21 
25  protected $ok = '';
26 
30  protected $upToDate = '';
31 
35  protected $error = '';
36 
40  protected $objectManager = NULL;
41 
45  protected $repositoryRepository = NULL;
46 
50  protected $listUtility = NULL;
51 
55  protected $languageService = NULL;
56 
60  public function __construct() {
61  $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
62  $this->repositoryRepository = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Domain\\Repository\\RepositoryRepository');
63  $this->listUtility = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\ListUtility');
64  $this->languageService = $this->objectManager->get('TYPO3\\CMS\\Lang\\LanguageService');
65  }
66 
72  public function getStatus() {
73  $status = array();
74  $status['mainRepositoryStatus'] = $this->getMainRepositoryStatus();
75 
76  $extensionStatus = $this->getSecurityStatusOfExtensions();
77  $status['extensionsSecurityStatusInstalled'] = $extensionStatus->loaded;
78  $status['extensionsSecurityStatusNotInstalled'] = $extensionStatus->existing;
79  $status['extensionsOutdatedStatusInstalled'] = $extensionStatus->loadedoutdated;
80  $status['extensionsOutdatedStatusNotInstalled'] = $extensionStatus->existingoutdated;
81 
82  return $status;
83  }
84 
90  protected function getMainRepositoryStatus() {
92  $mainRepository = $this->repositoryRepository->findOneTypo3OrgRepository();
93 
94  if (is_null($mainRepository) === TRUE) {
95  $value = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.notFound.value');
96  $message = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.notFound.message');
98  } elseif ($mainRepository->getLastUpdate()->getTimestamp() < $GLOBALS['EXEC_TIME'] - 24 * 60 * 60 * 7) {
99  $value = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.notUpToDate.value');
100  $message = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.notUpToDate.message');
102  } else {
103  $value = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.upToDate.value');
104  $message = '';
105  $severity = \TYPO3\CMS\Reports\Status::OK;
106  }
107 
109  $status = $this->objectManager->get(
110  'TYPO3\\CMS\\Reports\\Status',
111  $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.mainRepository.title'),
112  $value,
113  $message,
114  $severity
115  );
116 
117  return $status;
118  }
119 
125  protected function getSecurityStatusOfExtensions() {
126  $extensionInformation = $this->listUtility->getAvailableAndInstalledExtensionsWithAdditionalInformation();
127  $loadedInsecure = array();
128  $existingInsecure = array();
129  $loadedOutdated = array();
130  $existingOutdated = array();
131  foreach ($extensionInformation as $extensionKey => $information) {
132  if (
133  array_key_exists('terObject', $information)
134  && $information['terObject'] instanceof \TYPO3\CMS\Extensionmanager\Domain\Model\Extension
135  ) {
137  $terObject = $information['terObject'];
138  $insecureStatus = $terObject->getReviewState();
139  if ($insecureStatus === -1) {
140  if (
141  array_key_exists('installed', $information)
142  && $information['installed'] === TRUE
143  ) {
144  $loadedInsecure[] = array(
145  'extensionKey' => $extensionKey,
146  'version' => $terObject->getVersion(),
147  );
148  } else {
149  $existingInsecure[] = array(
150  'extensionKey' => $extensionKey,
151  'version' => $terObject->getVersion(),
152  );
153  }
154  } elseif ($insecureStatus === -2) {
155  if (
156  array_key_exists('installed', $information)
157  && $information['installed'] === TRUE
158  ) {
159  $loadedOutdated[] = array(
160  'extensionKey' => $extensionKey,
161  'version' => $terObject->getVersion(),
162  );
163  } else {
164  $existingOutdated[] = array(
165  'extensionKey' => $extensionKey,
166  'version' => $terObject->getVersion(),
167  );
168  }
169  }
170  }
171  }
172 
173  $result = new \stdClass();
174 
175  if (count($loadedInsecure) === 0) {
176  $value = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedExtensions.noInsecureExtensionLoaded.value');
177  $message = '';
178  $severity = \TYPO3\CMS\Reports\Status::OK;
179  } else {
180  $value = sprintf(
181  $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedExtensions.insecureExtensionLoaded.value'),
182  count($loadedInsecure)
183  );
184  $extensionList = array();
185  foreach ($loadedInsecure as $insecureExtension) {
186  $extensionList[] = sprintf(
187  $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedExtensions.insecureExtensionLoaded.message.extension'),
188  $insecureExtension['extensionKey'],
189  $insecureExtension['version']
190  );
191  }
192  $message = sprintf(
193  $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedExtensions.insecureExtensionLoaded.message'),
194  implode('', $extensionList)
195  );
197  }
198  $result->loaded = $this->objectManager->get(
199  'TYPO3\\CMS\\Reports\\Status',
200  $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedExtensions.title'),
201  $value,
202  $message,
203  $severity
204  );
205 
206  if (count($existingInsecure) === 0) {
207  $value = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingExtensions.noInsecureExtensionExists.value');
208  $message = '';
209  $severity = \TYPO3\CMS\Reports\Status::OK;
210  } else {
211  $value = sprintf(
212  $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingExtensions.insecureExtensionExists.value'),
213  count($existingInsecure)
214  );
215  $extensionList = array();
216  foreach ($existingInsecure as $insecureExtension) {
217  $extensionList[] = sprintf(
218  $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingExtensions.insecureExtensionExists.message.extension'),
219  $insecureExtension['extensionKey'],
220  $insecureExtension['version']
221  );
222  }
223  $message = sprintf(
224  $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingExtensions.insecureExtensionExists.message'),
225  implode('', $extensionList)
226  );
228  }
229  $result->existing = $this->objectManager->get(
230  'TYPO3\\CMS\\Reports\\Status',
231  $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingExtensions.title'),
232  $value,
233  $message,
234  $severity
235  );
236 
237  if (count($loadedOutdated) === 0) {
238  $value = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedOutdatedExtensions.noOutdatedExtensionLoaded.value');
239  $message = '';
240  $severity = \TYPO3\CMS\Reports\Status::OK;
241  } else {
242  $value = sprintf(
243  $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedOutdatedExtensions.outdatedExtensionLoaded.value'),
244  count($loadedOutdated)
245  );
246  $extensionList = array();
247  foreach ($loadedOutdated as $outdatedExtension) {
248  $extensionList[] = sprintf(
249  $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedOutdatedExtensions.outdatedExtensionLoaded.message.extension'),
250  $outdatedExtension['extensionKey'],
251  $outdatedExtension['version']
252  );
253  }
254  $message = sprintf(
255  $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedOutdatedExtensions.outdatedExtensionLoaded.message'),
256  implode('', $extensionList)
257  );
259  }
260  $result->loadedoutdated = $this->objectManager->get(
261  'TYPO3\\CMS\\Reports\\Status',
262  $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.loadedOutdatedExtensions.title'),
263  $value,
264  $message,
265  $severity
266  );
267 
268  if (count($existingOutdated) === 0) {
269  $value = $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingOutdatedExtensions.noOutdatedExtensionExists.value');
270  $message = '';
271  $severity = \TYPO3\CMS\Reports\Status::OK;
272  } else {
273  $value = sprintf(
274  $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingOutdatedExtensions.outdatedExtensionExists.value'),
275  count($existingOutdated)
276  );
277  $extensionList = array();
278  foreach ($existingOutdated as $outdatedExtension) {
279  $extensionList[] = sprintf(
280  $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingOutdatedExtensions.outdatedExtensionExists.message.extension'),
281  $outdatedExtension['extensionKey'],
282  $outdatedExtension['version']
283  );
284  }
285  $message = sprintf(
286  $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingOutdatedExtensions.outdatedExtensionExists.message'),
287  implode('', $extensionList)
288  );
290  }
291  $result->existingoutdated = $this->objectManager->get(
292  'TYPO3\\CMS\\Reports\\Status',
293  $this->languageService->sL('LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:report.status.existingOutdatedExtensions.title'),
294  $value,
295  $message,
296  $severity
297  );
298 
299  return $result;
300  }
301 }
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren&#39;t numeric.
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]