2 namespace TYPO3\CMS\Backend\Controller;
114 $this->
debug = (int)
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'debug'] === 1;
117 $this->moduleLoader->load(
$GLOBALS[
'TBE_MODULES']);
119 $this->pageRenderer->loadExtJS();
121 $this->pageRenderer->loadJquery();
122 $this->pageRenderer->addJsInlineCode(
'consoleOverrideWithDebugPanel',
'//already done',
false);
123 $this->pageRenderer->addExtDirectCode();
125 $this->jsFiles = array(
127 'md5' =>
'sysext/backend/Resources/Public/JavaScript/md5.js',
128 'modulemenu' =>
'sysext/backend/Resources/Public/JavaScript/modulemenu.js',
129 'evalfield' =>
'sysext/backend/Resources/Public/JavaScript/jsfunc.evalfield.js',
130 'notifications' =>
'sysext/backend/Resources/Public/JavaScript/notifications.js',
131 'backend' =>
'sysext/backend/Resources/Public/JavaScript/backend.js',
132 'viewport' =>
'sysext/backend/Resources/Public/JavaScript/extjs/viewport.js',
133 'iframepanel' =>
'sysext/backend/Resources/Public/JavaScript/iframepanel.js',
134 'backendcontentiframe' =>
'sysext/backend/Resources/Public/JavaScript/extjs/backendcontentiframe.js',
135 'viewportConfiguration' =>
'sysext/backend/Resources/Public/JavaScript/extjs/viewportConfiguration.js',
137 $this->pageRenderer->loadRequireJsModule(
'TYPO3/CMS/Backend/LoginRefresh',
'function(LoginRefresh) {
143 $this->pageRenderer->loadRequireJsModule(
'TYPO3/CMS/Backend/Utility');
146 $this->pageRenderer->loadRequireJsModule(
'TYPO3/CMS/Backend/Notification');
149 $this->pageRenderer->loadRequireJsModule(
'TYPO3/CMS/Backend/Modal');
152 $this->pageRenderer->loadRequireJsModule(
'TYPO3/CMS/Backend/LegacyCssClasses');
155 $this->pageRenderer->loadRequireJsModule(
'TYPO3/CMS/Backend/Storage',
'function(Storage) {
156 Storage.Persistent.load(' . json_encode($this->
getBackendUser()->uc) .
');
160 $this->pageRenderer->loadRequireJsModule(
'TYPO3/CMS/Backend/DebugConsole');
164 $rsaEncryptionEncoder->enableRsaEncryption(
true);
166 $this->pageRenderer->addInlineSetting(
'ShowItem',
'moduleUrl', BackendUtility::getModuleUrl(
'show_item'));
171 if (isset(
$GLOBALS[
'TBE_STYLES'][
'dims'][
'leftMenuFrameW'])) {
172 $this->menuWidth = (int)
$GLOBALS[
'TBE_STYLES'][
'dims'][
'leftMenuFrameW'];
184 $TYPO3backend = $this;
186 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'typo3/backend.php'][
'additionalBackendItems'])) {
187 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'typo3/backend.php'][
'additionalBackendItems'] as $additionalBackendItem) {
188 include_once $additionalBackendItem;
193 if (is_array(
$GLOBALS[
'TBE_MODULES'][
'_configuration'])) {
194 foreach (
$GLOBALS[
'TBE_MODULES'][
'_configuration'] as $moduleConfig) {
195 if (is_array($moduleConfig[
'cssFiles'])) {
196 foreach ($moduleConfig[
'cssFiles'] as $cssFileName => $cssFile) {
198 $files = \TYPO3\CMS\Core\Utility\GeneralUtility::removePrefixPathFromList($files, PATH_site);
199 $TYPO3backend->addCssFile($cssFileName,
'../' . $files[0]);
202 if (is_array($moduleConfig[
'jsFiles'])) {
203 foreach ($moduleConfig[
'jsFiles'] as $jsFile) {
205 $files = \TYPO3\CMS\Core\Utility\GeneralUtility::removePrefixPathFromList($files, PATH_site);
206 $TYPO3backend->addJavascriptFile(
'../' . $files[0]);
221 $toolbarItemInstances = array();
222 $classNameRegistry =
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'toolbarItems'];
223 foreach ($classNameRegistry as $className) {
226 throw new \RuntimeException(
227 'class ' . $className .
' is registered as toolbar item but does not implement'
228 . ToolbarItemInterface::class,
232 $index = (int)$toolbarItemInstance->getIndex();
233 if ($index < 0 || $index > 100) {
234 throw new \RuntimeException(
235 'getIndex() must return an integer between 0 and 100',
240 while (array_key_exists($index, $toolbarItemInstances)) {
243 $toolbarItemInstances[$index] = $toolbarItemInstance;
245 ksort($toolbarItemInstances);
246 $this->toolbarItems = $toolbarItemInstances;
260 $response->
getBody()->write($this->content);
277 $logoUrl =
$GLOBALS[
'TBE_STYLES'][
'logo'] ?:
'sysext/backend/Resources/Public/Images/typo3-topbar@2x.png';
279 list($logoWidth, $logoHeight) = @getimagesize($logoPath);
282 if (strpos($logoUrl,
'@2x.') !==
false) {
283 $logoWidth = $logoWidth/2;
284 $logoHeight = $logoHeight/2;
287 $view->assign(
'logoUrl', $logoUrl);
288 $view->assign(
'logoWidth', $logoWidth);
289 $view->assign(
'logoHeight', $logoHeight);
290 $view->assign(
'logoLink', TYPO3_URL_GENERAL);
291 $view->assign(
'applicationVersion', TYPO3_version);
292 $view->assign(
'siteName',
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename']);
294 $view->assign(
'toolbar', $this->renderToolbar());
299 foreach ($this->cssFiles as $cssFileName => $cssFile) {
300 $this->pageRenderer->addCssFile($cssFile);
302 if (!empty(
$GLOBALS[
'TBE_STYLES'][
'stylesheets'][$cssFileName])) {
303 $this->pageRenderer->addCssFile(
$GLOBALS[
'TBE_STYLES'][
'stylesheets'][$cssFileName]);
306 if (!empty($this->css)) {
307 $this->pageRenderer->addCssInlineBlock(
'BackendInlineCSS', $this->css);
309 foreach ($this->jsFiles as $jsFile) {
310 $this->pageRenderer->addJsFile($jsFile);
313 $this->pageRenderer->addJsInlineCode(
'BackendInlineJavascript', $this->js,
false);
318 $states = $this->
getBackendUser()->uc[
'BackendComponents'][
'States'];
321 Ext.state.Manager.setProvider(new TYPO3.state.ExtDirectProvider({
322 key: "BackendComponents.States",
328 $extOnReadyCode .=
'Ext.state.Manager.getProvider().initState(' . json_encode($states) .
');';
332 TYPO3.Backend = new TYPO3.Viewport(TYPO3.Viewport.configuration)';
333 $this->pageRenderer->addExtOnReadyCode($extOnReadyCode);
335 $title =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename'] ?
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename'] .
' [TYPO3 CMS ' . TYPO3_version .
']' :
'TYPO3 CMS ' . TYPO3_version;
338 $hookConfiguration = array(
'content' => &$this->content);
339 $this->
executeHook(
'renderPostProcess', $hookConfiguration);
349 if (!is_array(
$GLOBALS[
'TBE_MODULES'][
'_navigationComponents'])) {
352 $loadedComponents = array();
353 foreach (
$GLOBALS[
'TBE_MODULES'][
'_navigationComponents'] as $module => $info) {
354 if (in_array($info[
'componentId'], $loadedComponents)) {
357 $loadedComponents[] = $info[
'componentId'];
358 $component = strtolower(substr($info[
'componentId'], strrpos($info[
'componentId'],
'-') + 1));
359 $componentDirectory =
'components/' . $component .
'/';
360 if ($info[
'isCoreComponent']) {
361 $absoluteComponentPath = PATH_site .
'typo3/sysext/backend/Resources/Public/JavaScript/extjs/' . $componentDirectory;
362 $relativeComponentPath =
'../' . str_replace(PATH_site,
'', $absoluteComponentPath);
368 if (file_exists($absoluteComponentPath .
'css/loadorder.txt')) {
370 $loadOrder = str_replace(
'../',
'',
GeneralUtility::getUrl($absoluteComponentPath .
'css/loadorder.txt'));
375 $this->pageRenderer->addCssFile($relativeComponentPath .
'css/' . $cssFile);
378 if (file_exists($absoluteComponentPath .
'javascript/loadorder.txt')) {
380 $loadOrder = str_replace(
'../',
'',
GeneralUtility::getUrl($absoluteComponentPath .
'javascript/loadorder.txt'));
385 $this->pageRenderer->addJsFile($relativeComponentPath .
'javascript/' . $jsFile);
387 $this->pageRenderer->addInlineSetting(
'RecordHistory',
'moduleUrl', BackendUtility::getModuleUrl(
'record_history'));
388 $this->pageRenderer->addInlineSetting(
'NewRecord',
'moduleUrl', BackendUtility::getModuleUrl(
'db_new'));
389 $this->pageRenderer->addInlineSetting(
'FormEngine',
'moduleUrl', BackendUtility::getModuleUrl(
'record_edit'));
398 protected function renderToolbar()
401 foreach ($this->toolbarItems as $toolbarItem) {
403 if ($toolbarItem->checkAccess()) {
404 $hasDropDown = (bool)$toolbarItem->hasDropDown();
405 $additionalAttributes = (array)$toolbarItem->getAdditionalAttributes();
407 $liAttributes = array();
412 $classes[] =
'dropdown';
414 if (isset($additionalAttributes[
'class'])) {
415 $classes[] = $additionalAttributes[
'class'];
416 unset($additionalAttributes[
'class']);
418 $liAttributes[] =
'class="' . implode(
' ', $classes) .
'"';
421 foreach ($additionalAttributes as $name => $value) {
422 $liAttributes[] = $name .
'="' . $value .
'"';
426 $className = get_class($toolbarItem);
429 $className = str_replace(array(
'_',
'\\'),
'-', $className);
430 $liAttributes[] =
'id="' . $className .
'"';
432 $toolbar[] =
'<li ' . implode(
' ', $liAttributes) .
'>';
435 $toolbar[] =
'<a href="#" class="dropdown-toggle" data-toggle="dropdown">';
436 $toolbar[] = $toolbarItem->getItem();
438 $toolbar[] =
'<div class="dropdown-menu" role="menu">';
439 $toolbar[] = $toolbarItem->getDropDown();
440 $toolbar[] =
'</div>';
442 $toolbar[] = $toolbarItem->getItem();
444 $toolbar[] =
'</li>';
447 return implode(LF, $toolbar);
460 $filePath =
'typo3temp/Language/Backend-' . sha1($code) .
'.js';
461 if (!file_exists(PATH_site . $filePath)) {
464 if ($error !== null) {
465 throw new \RuntimeException(
'Locallang JS file could not be written to ' . $filePath .
'. Reason: ' . $error, 1295193026);
468 return '../' . $filePath;
481 'waitTitle' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_logging_in'),
482 'refresh_login_failed' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_failed'),
483 'refresh_login_failed_message' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_failed_message'),
484 'refresh_login_title' => sprintf(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_title'), htmlspecialchars($this->
getBackendUser()->user[
'username'])),
485 'login_expired' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.login_expired'),
486 'refresh_login_username' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_username'),
487 'refresh_login_password' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_password'),
488 'refresh_login_emptyPassword' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_emptyPassword'),
489 'refresh_login_button' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_button'),
490 'refresh_logout_button' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.refresh_logout_button'),
491 'refresh_exit_button' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.refresh_exit_button'),
492 'please_wait' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.please_wait'),
493 'loadingIndicator' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:loadingIndicator'),
494 'be_locked' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.be_locked'),
495 'refresh_login_countdown_singular' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_countdown_singular'),
496 'refresh_login_countdown' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_countdown'),
497 'login_about_to_expire' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.login_about_to_expire'),
498 'login_about_to_expire_title' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.login_about_to_expire_title'),
499 'refresh_login_logout_button' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_logout_button'),
500 'refresh_login_refresh_button' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_refresh_button'),
501 'tabs_closeAll' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:tabs.closeAll'),
502 'tabs_closeOther' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:tabs.closeOther'),
503 'tabs_close' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:tabs.close'),
504 'tabs_openInBrowserWindow' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:tabs.openInBrowserWindow'),
505 'csh_tooltip_loading' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:csh_tooltip_loading')
508 'fileUpload' => array(
512 'infoComponentMaxFileSize',
513 'infoComponentFileUploadLimit',
514 'infoComponentFileTypeLimit',
515 'infoComponentOverrideFiles',
521 'errorQueueLimitExceeded',
522 'errorQueueFileSizeLimit',
523 'errorQueueZeroByteFile',
524 'errorQueueInvalidFiletype',
526 'errorUploadMissingUrl',
528 'errorUploadSecurityError',
531 'errorUploadFileIDNotFound',
532 'errorUploadFileValidation',
533 'errorUploadFileCancelled',
534 'errorUploadStopped',
535 'allErrorMessageTitle',
536 'allErrorMessageText',
540 'liveSearch' => array(
548 'helpDescriptionPages',
549 'helpDescriptionContent'
552 'tooltipModuleMenuSplit',
553 'tooltipNavigationContainerSplitDrag',
554 'tooltipNavigationContainerSplitClick',
555 'tooltipDebugPanelSplitDrag'
558 $generatedLabels = array();
559 $generatedLabels[
'core'] = $coreLabels;
561 foreach ($labels as $categoryName => $categoryLabels) {
563 foreach ($categoryLabels as $label) {
565 $generatedLabels[$categoryName][$label] = $this->
getLanguageService()->getLL($categoryName .
'_' . $label);
568 return 'TYPO3.LLL = ' . json_encode($generatedLabels) .
';';
580 $dateFormat = (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'USdateFormat'] ? array(
'MM-DD-YYYY',
'HH:mm MM-DD-YYYY') : array(
'DD-MM-YYYY',
'HH:mm DD-MM-YYYY'));
581 $this->pageRenderer->addInlineSetting(
'DateTimePicker',
'DateFormat', $dateFormat);
583 $popupWindowWidth = 700;
584 $popupWindowHeight = 750;
585 $popupWindowSize = trim($beUser->getTSConfigVal(
'options.popupWindowSize'));
586 if (!empty($popupWindowSize)) {
591 $rtePopupWindowSize = trim($beUser->getTSConfigVal(
'options.rte.popupWindowSize'));
592 if (!empty($rtePopupWindowSize)) {
595 $rtePopupWindowWidth = !empty($rtePopupWindowWidth) ? (int)$rtePopupWindowWidth : ($popupWindowWidth-200);
596 $rtePopupWindowHeight = !empty($rtePopupWindowHeight) ? (int)$rtePopupWindowHeight : ($popupWindowHeight-250);
600 $newPageModule = trim($beUser->getTSConfigVal(
'options.overridePageModule'));
602 if (!$beUser->check(
'modules', $pageModule)) {
605 $t3Configuration = array(
607 'PATH_typo3' => $pathTYPO3,
608 'PATH_typo3_enc' => rawurlencode($pathTYPO3),
609 'username' => htmlspecialchars($beUser->user[
'username']),
610 'userUid' => htmlspecialchars($beUser->user[
'uid']),
612 'securityLevel' => trim(
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'loginSecurityLevel']) ?:
'normal',
613 'TYPO3_mainDir' => TYPO3_mainDir,
614 'pageModule' => $pageModule,
615 'inWorkspace' => $beUser->workspace !== 0,
616 'workspaceFrontendPreviewEnabled' => $beUser->user[
'workspace_preview'] ? 1 : 0,
617 'veriCode' => $beUser->veriCode(),
618 'denyFileTypes' => PHP_EXTENSIONS_DEFAULT,
619 'moduleMenuWidth' => $this->menuWidth - 1,
620 'topBarHeight' => isset(
$GLOBALS[
'TBE_STYLES'][
'dims'][
'topFrameH']) ? (int)
$GLOBALS[
'TBE_STYLES'][
'dims'][
'topFrameH'] : 30,
621 'showRefreshLoginPopup' => isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'showRefreshLoginPopup']) ? (int)
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'showRefreshLoginPopup'] :
false,
623 'debugInWindow' => $beUser->uc[
'debugInWindow'] ? 1 : 0,
624 'ContextHelpWindows' => array(
628 'PopupWindow' => array(
629 'width' => $popupWindowWidth,
630 'height' => $popupWindowHeight
632 'RTEPopupWindow' => array(
633 'width' => $rtePopupWindowWidth,
634 'height' => $rtePopupWindowHeight
638 TYPO3.configuration = ' . json_encode($t3Configuration) .
';
643 function typoSetup() { //
644 this.PATH_typo3 = TYPO3.configuration.PATH_typo3;
645 this.PATH_typo3_enc = TYPO3.configuration.PATH_typo3_enc;
646 this.username = TYPO3.configuration.username;
647 this.uniqueID = TYPO3.configuration.uniqueID;
648 this.securityLevel = TYPO3.configuration.securityLevel;
649 this.veriCode = TYPO3.configuration.veriCode;
650 this.denyFileTypes = TYPO3.configuration.denyFileTypes;
652 var TS = new typoSetup();
653 //backwards compatibility
662 function fsModules() { //
663 this.recentIds=new Array(); // used by frameset modules to track the most recent used id for list frame.
664 this.navFrameHighlightedID=new Array(); // used by navigation frames to track which row id was highlighted last time
665 this.currentMainLoaded="";
666 this.currentBank="0";
668 var fsMod = new fsModules();
670 top.goToModule = function(modName, cMR_flag, addGetVars) {
671 TYPO3.ModuleMenu.App.showModule(modName, addGetVars);
691 $where =
' AND (' . $beUser->getPagePermsClause(2) .
' OR ' . $beUser->getPagePermsClause(16) .
')';
696 if (is_array($records)) {
697 $editRecord = reset($records);
702 if (is_array($editRecord) && $beUser->isInWebMount($editRecord[
'uid'])) {
705 // Load page to edit:
706 window.setTimeout("top.loadEditId(' . (int)$editRecord[
'uid'] .
');", 500);
709 if (!$beUser->getTSConfigVal(
'options.bookmark_onEditId_dontSetPageTree')) {
710 $bookmarkKeepExpanded = $beUser->getTSConfigVal(
'options.bookmark_onEditId_keepExistingExpanded');
716 // Warning about page editing:
731 $startModuleParameters =
'';
735 if (isset($beUser->uc[
'startModuleOnFirstLogin'])) {
736 $startModule = $beUser->uc[
'startModuleOnFirstLogin'];
737 unset($beUser->uc[
'startModuleOnFirstLogin']);
739 }
elseif ($beUser->uc[
'startModule']) {
740 $startModule = $beUser->uc[
'startModule'];
741 }
elseif ($beUser->uc[
'startInTaskCenter']) {
742 $startModule =
'user_task';
747 if (strpos($startModule,
'->') !==
false) {
748 list($startModule, $startModuleParameters) = explode(
'->', $startModule, 2);
754 if (!$moduleParameters && $startModuleParameters) {
755 $moduleParameters = $startModuleParameters;
778 if (!is_string($javascript)) {
779 throw new \InvalidArgumentException(
'parameter $javascript must be of type string', 1195129553);
781 $this->js .= $javascript;
792 $jsFileAdded =
false;
795 $this->jsFiles[] = $javascriptFile;
810 if (!is_string(
$css)) {
811 throw new \InvalidArgumentException(
'parameter $css must be of type string', 1195129642);
825 $cssFileAdded =
false;
826 if (empty($this->cssFiles[$cssFileName])) {
827 $this->cssFiles[$cssFileName] = $cssFile;
828 $cssFileAdded =
true;
830 return $cssFileAdded;
859 protected function executeHook($identifier, array $hookConfiguration = array())
861 $options = &
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'typo3/backend.php'];
862 if (isset($options[$identifier]) && is_array($options[$identifier])) {
863 foreach ($options[$identifier] as $hookFunction) {
878 $moduleStorage = $this->backendModuleRepository->loadAllowedModules(array(
'user',
'help'));
881 $view->assign(
'modules', $moduleStorage);
882 return $view->render();
909 if ($templatePathAndFileName) {