TYPO3 CMS  TYPO3_8-7
PageInformationController.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
21 
26 {
32  public function modMenu()
33  {
34  return [
35  'pages' => [
36  0 => $GLOBALS['LANG']->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_webinfo.xlf:pages_0'),
37  2 => $GLOBALS['LANG']->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_webinfo.xlf:pages_2'),
38  1 => $GLOBALS['LANG']->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_webinfo.xlf:pages_1')
39  ],
40  'depth' => [
41  0 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'),
42  1 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'),
43  2 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_2'),
44  3 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_3'),
45  4 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_4'),
46  999 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_infi')
47  ]
48  ];
49  }
50 
56  public function main()
57  {
58  $theOutput = '<h1>' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_webinfo.xlf:page_title')) . '</h1>';
59  $dblist = GeneralUtility::makeInstance(PageLayoutView::class);
60  $dblist->descrTable = '_MOD_web_info';
61  $dblist->thumbs = 0;
62  $dblist->script = BackendUtility::getModuleUrl('web_info');
63  $dblist->showIcon = 0;
64  $dblist->setLMargin = 0;
65  $dblist->agePrefixes = $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.minutesHoursDaysYears');
66  $dblist->pI_showUser = 1;
67 
68  switch ((int)$this->pObj->MOD_SETTINGS['pages']) {
69  case 1:
70  $dblist->fieldArray = ['title', 'uid'] + array_keys($this->cleanTableNames());
71  break;
72  case 2:
73  $dblist->fieldArray = [
74  'title',
75  'uid',
76  'lastUpdated',
77  'newUntil',
78  'no_cache',
79  'cache_timeout',
80  'php_tree_stop',
81  'TSconfig',
82  'is_siteroot',
83  'fe_login_mode'
84  ];
85  break;
86  default:
87  $dblist->fieldArray = [
88  'title',
89  'uid',
90  'alias',
91  'starttime',
92  'endtime',
93  'fe_group',
94  'target',
95  'url',
96  'shortcut',
97  'shortcut_mode'
98  ];
99  }
100 
101  // PAGES:
102  $this->pObj->MOD_SETTINGS['pages_levels'] = $this->pObj->MOD_SETTINGS['depth'];
103  // ONLY for the sake of dblist module which uses this value.
104  $h_func = BackendUtility::getDropdownMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth']);
105  $h_func .= BackendUtility::getDropdownMenu($this->pObj->id, 'SET[pages]', $this->pObj->MOD_SETTINGS['pages'], $this->pObj->MOD_MENU['pages']);
106  $dblist->start($this->pObj->id, 'pages', 0);
107  $dblist->generateList();
108  // CSH
109  $optionKey = $this->pObj->MOD_SETTINGS['pages'];
110  $cshPagetreeOverview = BackendUtility::cshItem($dblist->descrTable, 'func_' . $optionKey, null, '<span class="btn btn-default btn-sm">|</span>');
111 
112  $theOutput .= '<div class="form-inline form-inline-spaced">'
113  . $h_func
114  . '<div class="form-group">' . $cshPagetreeOverview . '</div>'
115  . '</div>'
116  . $dblist->HTMLcode;
117 
118  // Additional footer content
119  $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/web_info/class.tx_cms_webinfo.php']['drawFooterHook'];
120  if (is_array($footerContentHook)) {
121  foreach ($footerContentHook as $hook) {
122  $params = [];
123  $theOutput .= GeneralUtility::callUserFunction($hook, $params, $this);
124  }
125  }
126  return $theOutput;
127  }
128 
136  protected function cleanTableNames()
137  {
138  // Get all table names:
139  $tableNames = array_flip(array_keys($GLOBALS['TCA']));
140  // Unset common names:
141  unset($tableNames['pages']);
142  unset($tableNames['static_template']);
143  unset($tableNames['sys_filemounts']);
144  unset($tableNames['sys_action']);
145  unset($tableNames['sys_workflows']);
146  unset($tableNames['be_users']);
147  unset($tableNames['be_groups']);
148  $allowedTableNames = [];
149  // Traverse table names and set them in allowedTableNames array IF they can be read-accessed by the user.
150  if (is_array($tableNames)) {
151  foreach ($tableNames as $k => $v) {
152  if (!$GLOBALS['TCA'][$k]['ctrl']['hideTable'] && $this->getBackendUser()->check('tables_select', $k)) {
153  $allowedTableNames['table_' . $k] = $k;
154  }
155  }
156  }
157  return $allowedTableNames;
158  }
159 
163  protected function getBackendUser()
164  {
165  return $GLOBALS['BE_USER'];
166  }
167 }
static callUserFunction($funcName, &$params, &$ref, $_='', $errorMode=0)
static makeInstance($className,... $constructorArguments)
static cshItem($table, $field, $_='', $wrap='')
static getDropdownMenu( $mainParams, $elementName, $currentValue, $menuItems, $script='', $addParams='')
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']