TYPO3 CMS  TYPO3_6-2
AdminPanelView.php
Go to the documentation of this file.
1 <?php
3 
20 
25 
31  protected $extNeedUpdate = FALSE;
32 
38  protected $ext_forcePreview = FALSE;
39 
43  protected $extJSCODE = '';
44 
48  public function __construct() {
49  $this->initialize();
50  }
51 
57  public function initialize() {
58  $this->saveConfigOptions();
59  // Setting some values based on the admin panel
60  $GLOBALS['TSFE']->forceTemplateParsing = $this->extGetFeAdminValue('tsdebug', 'forceTemplateParsing');
61  $GLOBALS['TSFE']->displayEditIcons = $this->extGetFeAdminValue('edit', 'displayIcons');
62  $GLOBALS['TSFE']->displayFieldEditIcons = $this->extGetFeAdminValue('edit', 'displayFieldIcons');
63  if ($this->extGetFeAdminValue('tsdebug', 'displayQueries')) {
64  // Do not override if the value is already set in \TYPO3\CMS\Core\Database\DatabaseConnection
65  if ($GLOBALS['TYPO3_DB']->explainOutput == 0) {
66  // Enable execution of EXPLAIN SELECT queries
67  $GLOBALS['TYPO3_DB']->explainOutput = 3;
68  }
69  }
70  if (GeneralUtility::_GP('ADMCMD_editIcons')) {
71  $GLOBALS['TSFE']->displayFieldEditIcons = 1;
72  }
73  if (GeneralUtility::_GP('ADMCMD_simUser')) {
74  $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_simulateUserGroup'] = (int)GeneralUtility::_GP('ADMCMD_simUser');
75  $this->ext_forcePreview = TRUE;
76  }
77  if (GeneralUtility::_GP('ADMCMD_simTime')) {
78  $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_simulateDate'] = (int)GeneralUtility::_GP('ADMCMD_simTime');
79  $this->ext_forcePreview = TRUE;
80  }
81  if ($GLOBALS['TSFE']->forceTemplateParsing) {
82  $GLOBALS['TSFE']->set_no_cache('Admin Panel: Force template parsing', TRUE);
83  } elseif ($GLOBALS['TSFE']->displayEditIcons) {
84  $GLOBALS['TSFE']->set_no_cache('Admin Panel: Display edit icons', TRUE);
85  } elseif ($GLOBALS['TSFE']->displayFieldEditIcons) {
86  $GLOBALS['TSFE']->set_no_cache('Admin Panel: Display field edit icons', TRUE);
87  } elseif (GeneralUtility::_GP('ADMCMD_view')) {
88  $GLOBALS['TSFE']->set_no_cache('Admin Panel: Display preview', TRUE);
89  }
90  }
91 
97  public function getAdminPanelHeaderData() {
98  $result = '';
99  if (!empty($GLOBALS['TBE_STYLES']['stylesheets']['admPanel'])) {
100  $stylesheet = GeneralUtility::locationHeaderUrl($GLOBALS['TBE_STYLES']['stylesheets']['admPanel']);
101  $result = '<link rel="stylesheet" type="text/css" href="' . htmlspecialchars($stylesheet) . '" />';
102  }
103  return $result;
104  }
105 
112  public function isAdminModuleEnabled($key) {
113  $result = FALSE;
114  // Returns TRUE if the module checked is "preview" and the forcePreview flag is set.
115  if ($key === 'preview' && $this->ext_forcePreview) {
116  $result = TRUE;
117  } elseif (!empty($GLOBALS['BE_USER']->extAdminConfig['enable.']['all'])) {
118  $result = TRUE;
119  } elseif (!empty($GLOBALS['BE_USER']->extAdminConfig['enable.'][$key])) {
120  $result = TRUE;
121  }
122  return $result;
123  }
124 
131  public function saveConfigOptions() {
132  $input = GeneralUtility::_GP('TSFE_ADMIN_PANEL');
133  if (is_array($input)) {
134  // Setting
135  $GLOBALS['BE_USER']->uc['TSFE_adminConfig'] = array_merge(!is_array($GLOBALS['BE_USER']->uc['TSFE_adminConfig']) ? array() : $GLOBALS['BE_USER']->uc['TSFE_adminConfig'], $input);
136  // Candidate for GeneralUtility::array_merge() if integer-keys will some day make trouble...
137  unset($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['action']);
138  // Actions:
139  if ($input['action']['clearCache'] && $this->isAdminModuleEnabled('cache')) {
140  $GLOBALS['BE_USER']->extPageInTreeInfo = array();
141  $theStartId = (int)$input['cache_clearCacheId'];
142  $GLOBALS['TSFE']->clearPageCacheContent_pidList($GLOBALS['BE_USER']->extGetTreeList($theStartId, $this->extGetFeAdminValue('cache', 'clearCacheLevels'), 0, $GLOBALS['BE_USER']->getPagePermsClause(1)) . $theStartId);
143  }
144  // Saving
145  $GLOBALS['BE_USER']->writeUC();
146  }
147  $GLOBALS['TT']->LR = $this->extGetFeAdminValue('tsdebug', 'LR');
148  if ($this->extGetFeAdminValue('cache', 'noCache')) {
149  $GLOBALS['TSFE']->set_no_cache('Admin Panel: No Caching', TRUE);
150  }
151  }
152 
160  public function extGetFeAdminValue($sectionName, $val = '') {
161  if (!$this->isAdminModuleEnabled($sectionName)) {
162  return NULL;
163  }
164 
165  // Exceptions where the values can be overridden (forced) from backend:
166  // deprecated
167  if (
168  $sectionName === 'edit' && (
169  $val === 'displayIcons' && $GLOBALS['BE_USER']->extAdminConfig['module.']['edit.']['forceDisplayIcons'] ||
170  $val === 'displayFieldIcons' && $GLOBALS['BE_USER']->extAdminConfig['module.']['edit.']['forceDisplayFieldIcons'] ||
171  $val === 'editNoPopup' && $GLOBALS['BE_USER']->extAdminConfig['module.']['edit.']['forceNoPopup']
172  )
173  ) {
174  return TRUE;
175  }
176 
177  // Override all settings with user TSconfig
178  if ($val && isset($GLOBALS['BE_USER']->extAdminConfig['override.'][$sectionName . '.'][$val])) {
179  return $GLOBALS['BE_USER']->extAdminConfig['override.'][$sectionName . '.'][$val];
180  }
181  if (isset($GLOBALS['BE_USER']->extAdminConfig['override.'][$sectionName])) {
182  return $GLOBALS['BE_USER']->extAdminConfig['override.'][$sectionName];
183  }
184 
185  $returnValue = $val ? $GLOBALS['BE_USER']->uc['TSFE_adminConfig'][$sectionName . '_' . $val] : 1;
186 
187  // Exception for preview
188  if ($sectionName === 'preview' && $this->ext_forcePreview) {
189  return !$val ? TRUE : $returnValue;
190  }
191 
192  // See if the menu is expanded!
193  return $this->isAdminModuleOpen($sectionName) ? $returnValue : NULL;
194  }
195 
201  public function forcePreview() {
202  $this->ext_forcePreview = TRUE;
203  }
204 
211  public function isAdminModuleOpen($key) {
212  return $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_top'] && $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_' . $key];
213  }
214 
221  public function display() {
222  $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_tsfe.xlf');
223  $moduleContent = $footer = '';
224 
225  if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_top']) {
226  if ($this->isAdminModuleEnabled('preview')) {
227  $moduleContent .= $this->getPreviewModule();
228  }
229  if ($this->isAdminModuleEnabled('cache')) {
230  $moduleContent .= $this->getCacheModule();
231  }
232  if ($this->isAdminModuleEnabled('edit')) {
233  $moduleContent .= $this->getEditModule();
234  }
235  if ($this->isAdminModuleEnabled('tsdebug')) {
236  $moduleContent .= $this->getTSDebugModule();
237  }
238  if ($this->isAdminModuleEnabled('info')) {
239  $moduleContent .= $this->getInfoModule();
240  }
241  }
242  if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_adminpanel.php']['extendAdminPanel'])) {
243  foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_adminpanel.php']['extendAdminPanel'] as $classRef) {
244  $hookObject = GeneralUtility::getUserObj($classRef);
245  if (!$hookObject instanceof AdminPanelViewHookInterface) {
246  throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Frontend\\View\\AdminPanelViewHookInterface', 1311942539);
247  }
248  $moduleContent .= $hookObject->extendAdminPanel($moduleContent, $this);
249  }
250  }
251  $row = $this->extGetLL('adminPanelTitle') . ': <span class="typo3-adminPanel-beuser">' . htmlspecialchars($GLOBALS['BE_USER']->user['username']) . '</span>';
252  $isVisible = $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_top'];
253  $cssClassName = 'typo3-adminPanel-panel-' . ($isVisible ? 'open' : 'closed');
254  $header = '<tr class="typo3-adminPanel-header">' . '<td colspan="2" id="typo3-adminPanel-header" class="' . $cssClassName . '">' . '<span class="typo3-adminPanel-header-title">' . $row . '</span>' . $this->linkSectionHeader('top', '<span class="typo3-adminPanel-header-button"></span>', 'typo3-adminPanel-header-buttonWrapper') . '<input type="hidden" name="TSFE_ADMIN_PANEL[display_top]" value="' . $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_top'] . '" /></td>' . '</tr>';
255  if ($moduleContent && $this->extNeedUpdate) {
256  $footer = '<tr class="typo3-adminPanel-footer">
257  <td colspan="2">
258  <input class="typo3-adminPanel-update" type="submit" value="' . $this->extGetLL('update') . '" />
259  </td>
260  </tr>';
261  }
262  $query = !GeneralUtility::_GET('id') ? '<input type="hidden" name="id" value="' . $GLOBALS['TSFE']->id . '" />' : '';
263 
264  // The dummy field is needed for Firefox: to force a page reload on submit
265  // which must change the form value with JavaScript (see "onsubmit" attribute of the "form" element")
266  $query .= '<input type="hidden" name="TSFE_ADMIN_PANEL[DUMMY]" value="" />';
267  foreach (GeneralUtility::_GET() as $key => $value) {
268  if ($key != 'TSFE_ADMIN_PANEL') {
269  if (is_array($value)) {
270  $query .= $this->getHiddenFields($key, $value);
271  } else {
272  $query .= '<input type="hidden" name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($value) . '" />';
273  }
274  }
275  }
276  $out = '
277 <!--
278  TYPO3 Admin panel start
279 -->
280 <a id="TSFE_ADMIN"></a>
281 <form id="TSFE_ADMIN_PANEL_FORM" name="TSFE_ADMIN_PANEL_FORM" action="' . htmlspecialchars(GeneralUtility::getIndpEnv('TYPO3_REQUEST_SCRIPT')) . '#TSFE_ADMIN" method="get" onsubmit="document.forms.TSFE_ADMIN_PANEL_FORM[\'TSFE_ADMIN_PANEL[DUMMY]\'].value=Math.random().toString().substring(2,8)">' . $query . '<table class="typo3-adminPanel">' . $header . $moduleContent . $footer . '</table></form>';
282  if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_top']) {
283  $out .= '<script type="text/javascript" src="typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.evalfield.js"></script>';
284  $out .= '<script type="text/javascript">/*<![CDATA[*/' . GeneralUtility::minifyJavaScript('
285  var evalFunc = new evalFunc();
286  // TSFEtypo3FormFieldSet()
287  function TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue) { //
288  var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
289  var theValue = document.TSFE_ADMIN_PANEL_FORM[theField].value;
290  if (checkbox && theValue==checkboxValue) {
291  document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value="";
292  alert(theField);
293  document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "";
294  } else {
295  document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value = evalFunc.outputObjValue(theFObj, theValue);
296  if (document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"]) {
297  document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "on";
298  }
299  }
300  }
301  // TSFEtypo3FormFieldGet()
302  function TSFEtypo3FormFieldGet(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off) { //
303  var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
304  if (checkbox_off) {
305  document.TSFE_ADMIN_PANEL_FORM[theField].value=checkboxValue;
306  }else{
307  document.TSFE_ADMIN_PANEL_FORM[theField].value = evalFunc.evalObjValue(theFObj, document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value);
308  }
309  TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue);
310  }') . '/*]]>*/</script><script language="javascript" type="text/javascript">' . $this->extJSCODE . '</script>';
311  }
312  $out .= '<script src="' . GeneralUtility::locationHeaderUrl('typo3/sysext/frontend/Resources/Public/JavaScript/AdminPanel.js') . '" type="text/javascript"></script><script type="text/javascript">/*<![CDATA[*/' . 'typo3AdminPanel = new TYPO3AdminPanel();typo3AdminPanel.init("typo3-adminPanel-header", "TSFE_ADMIN_PANEL_FORM");' . '/*]]>*/</script>
313 <!--
314  TYPO3 admin panel end
315 -->
316 ';
317  return $out;
318  }
319 
329  protected function getHiddenFields($key, array $val) {
330  $out = '';
331  foreach ($val as $k => $v) {
332  if (is_array($v)) {
333  $out .= $this->getHiddenFields($key . '[' . $k . ']', $v);
334  } else {
335  $out .= '<input type="hidden" name="' . htmlspecialchars($key) . '[' . htmlspecialchars($k) . ']" value="' . htmlspecialchars($v) . '">' . LF;
336  }
337  }
338  return $out;
339  }
340 
341  /*****************************************************
342  * Creating sections of the Admin Panel
343  ****************************************************/
350  protected function getPreviewModule() {
351  $out = $this->extGetHead('preview');
352  if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_preview']) {
353  $this->extNeedUpdate = TRUE;
354  $out .= $this->extGetItem('preview_showHiddenPages', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[preview_showHiddenPages]" value="0" /><input type="checkbox" id="preview_showHiddenPages" name="TSFE_ADMIN_PANEL[preview_showHiddenPages]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_showHiddenPages'] ? ' checked="checked"' : '') . ' />');
355  $out .= $this->extGetItem('preview_showHiddenRecords', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[preview_showHiddenRecords]" value="0" /><input type="checkbox" id="preview_showHiddenRecords" name="TSFE_ADMIN_PANEL[preview_showHiddenRecords]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_showHiddenRecords'] ? ' checked="checked"' : '') . ' />');
356  // Simulate date
357  $out .= $this->extGetItem('preview_simulateDate', '<input type="text" id="preview_simulateDate" name="TSFE_ADMIN_PANEL[preview_simulateDate]_hr" onchange="TSFEtypo3FormFieldGet(\'TSFE_ADMIN_PANEL[preview_simulateDate]\', \'datetime\', \'\', 1,0);" /><input type="hidden" name="TSFE_ADMIN_PANEL[preview_simulateDate]" value="' . $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_simulateDate'] . '" />');
358  $this->extJSCODE .= 'TSFEtypo3FormFieldSet("TSFE_ADMIN_PANEL[preview_simulateDate]", "datetime", "", 0, 0);';
359  // Simulate fe_user:
360 
361  $options = '';
362 
363  $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
364  'fe_groups.uid, fe_groups.title',
365  'fe_groups,pages',
366  'pages.uid=fe_groups.pid AND pages.deleted=0 ' . BackendUtility::deleteClause('fe_groups') . ' AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1),
367  '',
368  'fe_groups.title ASC'
369  );
370  while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
371  $options .= '<option value="' . $row['uid'] . '"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_simulateUserGroup'] == $row['uid'] ? ' selected="selected"' : '') . '>' . htmlspecialchars(($row['title'] . ' [' . $row['uid'] . ']')) . '</option>';
372  }
373  $GLOBALS['TYPO3_DB']->sql_free_result($res);
374  if ($options) {
375  $options = '<option value="0">&nbsp;</option>' . $options;
376  $out .= $this->extGetItem('preview_simulateUserGroup', '<select id="preview_simulateUserGroup" name="TSFE_ADMIN_PANEL[preview_simulateUserGroup]">' . $options . '</select>');
377  }
378  }
379  return $out;
380  }
381 
388  protected function getCacheModule() {
389  $out = $this->extGetHead('cache');
390  if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_cache']) {
391  $this->extNeedUpdate = TRUE;
392  $out .= $this->extGetItem('cache_noCache', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[cache_noCache]" value="0" /><input id="cache_noCache" type="checkbox" name="TSFE_ADMIN_PANEL[cache_noCache]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['cache_noCache'] ? ' checked="checked"' : '') . ' />');
393  $levels = $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['cache_clearCacheLevels'];
394  $options = '';
395  $options .= '<option value="0"' . ($levels == 0 ? ' selected="selected"' : '') . '>' . $this->extGetLL('div_Levels_0') . '</option>';
396  $options .= '<option value="1"' . ($levels == 1 ? ' selected="selected"' : '') . '>' . $this->extGetLL('div_Levels_1') . '</option>';
397  $options .= '<option value="2"' . ($levels == 2 ? ' selected="selected"' : '') . '>' . $this->extGetLL('div_Levels_2') . '</option>';
398  $out .= $this->extGetItem('cache_clearLevels', '<select id="cache_clearLevels" name="TSFE_ADMIN_PANEL[cache_clearCacheLevels]">' . $options . '</select>' . '<input type="hidden" name="TSFE_ADMIN_PANEL[cache_clearCacheId]" value="' . $GLOBALS['TSFE']->id . '" /> <input type="submit" value="' . $this->extGetLL('update') . '" />');
399  // Generating tree:
400  $depth = (int)$this->extGetFeAdminValue('cache', 'clearCacheLevels');
401  $outTable = '';
402  $GLOBALS['BE_USER']->extPageInTreeInfo = array();
403  $GLOBALS['BE_USER']->extPageInTreeInfo[] = array($GLOBALS['TSFE']->page['uid'], htmlspecialchars($GLOBALS['TSFE']->page['title']), $depth + 1);
404  $GLOBALS['BE_USER']->extGetTreeList($GLOBALS['TSFE']->id, $depth, 0, $GLOBALS['BE_USER']->getPagePermsClause(1));
405  foreach ($GLOBALS['BE_USER']->extPageInTreeInfo as $row) {
406  $outTable .= '<tr>' . '<td><img src="typo3/gfx/clear.gif" width="' . ($depth + 1 - $row[2]) * 18 . '" height="1" alt="" /><img ' . IconUtility::skinImg(TYPO3_mainDir, 'gfx/i/pages.gif', 'width="18" height="16"') . ' align="top" alt="" /> ' . htmlspecialchars($row[1]) . '</td><td>' . $GLOBALS['BE_USER']->extGetNumberOfCachedPages($row[0]) . '</td></tr>';
407  }
408  $outTable = '<br /><table>' . $outTable . '</table>';
409  $outTable .= '<input type="submit" name="TSFE_ADMIN_PANEL[action][clearCache]" value="' . $this->extGetLL('cache_doit') . '" />';
410  $out .= $this->extGetItem('cache_cacheEntries', $outTable);
411  }
412  return $out;
413  }
414 
421  protected function getEditModule() {
422  $out = $this->extGetHead('edit');
423  if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_edit']) {
424  // If another page module was specified, replace the default Page module with the new one
425  $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
426  $pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
427  $this->extNeedUpdate = TRUE;
428  $out .= $this->extGetItem('edit_displayFieldIcons', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[edit_displayFieldIcons]" value="0" /><input type="checkbox" id="edit_displayFieldIcons" name="TSFE_ADMIN_PANEL[edit_displayFieldIcons]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_displayFieldIcons'] ? ' checked="checked"' : '') . ' />');
429  $out .= $this->extGetItem('edit_displayIcons', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[edit_displayIcons]" value="0" /><input type="checkbox" id="edit_displayIcons" name="TSFE_ADMIN_PANEL[edit_displayIcons]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_displayIcons'] ? ' checked="checked"' : '') . ' />');
430  $out .= $this->extGetItem('', $this->ext_makeToolBar());
431  if (!GeneralUtility::_GP('ADMCMD_view')) {
432  $out .= $this->extGetItem('', '<a href="#" onclick="' . htmlspecialchars(('
433  if (parent.opener && parent.opener.top && parent.opener.top.TS) {
434  parent.opener.top.fsMod.recentIds["web"]=' . (int)$GLOBALS['TSFE']->page['uid'] . ';
435  if (parent.opener.top.content && parent.opener.top.content.nav_frame && parent.opener.top.content.nav_frame.refresh_nav) {
436  parent.opener.top.content.nav_frame.refresh_nav();
437  }
438  parent.opener.top.goToModule("' . $pageModule . '");
439  parent.opener.top.focus();
440  } else {
441  vHWin=window.open(\'' . TYPO3_mainDir . BackendUtility::getBackendScript() . '\',\'' . md5(('Typo3Backend-' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'])) . '\',\'status=1,menubar=1,scrollbars=1,resizable=1\');
442  vHWin.focus();
443  }
444  return false;
445  ')) . '">' . $this->extGetLL('edit_openAB') . '</a>');
446  }
447  }
448  return $out;
449  }
450 
457  protected function getTSDebugModule() {
458  $out = $this->extGetHead('tsdebug');
459  if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_tsdebug']) {
460  $this->extNeedUpdate = TRUE;
461  $out .= $this->extGetItem('tsdebug_tree', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_tree]" value="0" /><input type="checkbox" id="tsdebug_tree" name="TSFE_ADMIN_PANEL[tsdebug_tree]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_tree'] ? ' checked="checked"' : '') . ' />');
462  $out .= $this->extGetItem('tsdebug_displayTimes', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayTimes]" value="0" /><input id="tsdebug_displayTimes" type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_displayTimes]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_displayTimes'] ? ' checked="checked"' : '') . ' />');
463  $out .= $this->extGetItem('tsdebug_displayMessages', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayMessages]" value="0" /><input type="checkbox" id="tsdebug_displayMessages" name="TSFE_ADMIN_PANEL[tsdebug_displayMessages]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_displayMessages'] ? ' checked="checked"' : '') . ' />');
464  $out .= $this->extGetItem('tsdebug_LR', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_LR]" value="0" /><input type="checkbox" id="tsdebug_LR" name="TSFE_ADMIN_PANEL[tsdebug_LR]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_LR'] ? ' checked="checked"' : '') . ' />');
465  $out .= $this->extGetItem('tsdebug_displayContent', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayContent]" value="0" /><input type="checkbox" id="tsdebug_displayContent" name="TSFE_ADMIN_PANEL[tsdebug_displayContent]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_displayContent'] ? ' checked="checked"' : '') . ' />');
466  $out .= $this->extGetItem('tsdebug_displayQueries', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayQueries]" value="0" /><input type="checkbox" id="tsdebug_displayQueries" name="TSFE_ADMIN_PANEL[tsdebug_displayQueries]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_displayQueries'] ? ' checked="checked"' : '') . ' />');
467  $out .= $this->extGetItem('tsdebug_forceTemplateParsing', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_forceTemplateParsing]" value="0" /><input type="checkbox" id="tsdebug_forceTemplateParsing" name="TSFE_ADMIN_PANEL[tsdebug_forceTemplateParsing]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_forceTemplateParsing'] ? ' checked="checked"' : '') . ' />');
468  $GLOBALS['TT']->printConf['flag_tree'] = $this->extGetFeAdminValue('tsdebug', 'tree');
469  $GLOBALS['TT']->printConf['allTime'] = $this->extGetFeAdminValue('tsdebug', 'displayTimes');
470  $GLOBALS['TT']->printConf['flag_messages'] = $this->extGetFeAdminValue('tsdebug', 'displayMessages');
471  $GLOBALS['TT']->printConf['flag_content'] = $this->extGetFeAdminValue('tsdebug', 'displayContent');
472  $GLOBALS['TT']->printConf['flag_queries'] = $this->extGetFeAdminValue('tsdebug', 'displayQueries');
473  $out .= '<tr><td colspan="2">' . $GLOBALS['TT']->printTSlog() . '</td></tr>';
474  }
475  return $out;
476  }
477 
484  protected function getInfoModule() {
485  $head = $this->extGetHead('info');
486  $out = '';
487  if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_info']) {
488  $tableArr = array();
489  if ($this->extGetFeAdminValue('cache', 'noCache')) {
490  $theBytes = 0;
491  $count = 0;
492  if (count($GLOBALS['TSFE']->imagesOnPage)) {
493  $tableArr[] = array($this->extGetLL('info_imagesOnPage'), count($GLOBALS['TSFE']->imagesOnPage), TRUE);
494  foreach ($GLOBALS['TSFE']->imagesOnPage as $file) {
495  $fs = @filesize($file);
496  $tableArr[] = array(TAB . $file, GeneralUtility::formatSize($fs));
497  $theBytes += $fs;
498  $count++;
499  }
500  }
501  // Add an empty line
502  $tableArr[] = array($this->extGetLL('info_imagesSize'), GeneralUtility::formatSize($theBytes), TRUE);
503  $tableArr[] = array($this->extGetLL('info_DocumentSize'), GeneralUtility::formatSize(strlen($GLOBALS['TSFE']->content)), TRUE);
504  $tableArr[] = array('', '');
505  }
506  $tableArr[] = array($this->extGetLL('info_id'), $GLOBALS['TSFE']->id);
507  $tableArr[] = array($this->extGetLL('info_type'), $GLOBALS['TSFE']->type);
508  $tableArr[] = array($this->extGetLL('info_groupList'), $GLOBALS['TSFE']->gr_list);
509  $tableArr[] = array($this->extGetLL('info_noCache'), $this->extGetLL('info_noCache_' . ($GLOBALS['TSFE']->no_cache ? 'no' : 'yes')));
510  $tableArr[] = array($this->extGetLL('info_countUserInt'), count($GLOBALS['TSFE']->config['INTincScript']));
511 
512  if (!empty($GLOBALS['TSFE']->fe_user->user['uid'])) {
513  $tableArr[] = array($this->extGetLL('info_feuserName'), htmlspecialchars($GLOBALS['TSFE']->fe_user->user['username']));
514  $tableArr[] = array($this->extGetLL('info_feuserId'), htmlspecialchars($GLOBALS['TSFE']->fe_user->user['uid']));
515  }
516  $tableArr[] = array($this->extGetLL('info_totalParsetime'), $GLOBALS['TSFE']->scriptParseTime . ' ms', TRUE);
517  $table = '';
518  foreach ($tableArr as $key => $arr) {
519  $label = (isset($arr[2]) ? '<strong>' . $arr[0] . '</strong>' : $arr[0]);
520  $value = strlen($arr[1]) ? $arr[1] : '';
521  $table .=
522  '<tr class="typo3-adminPanel-itemRow ' . ($key % 2 == 0 ? 'line-even' : 'line-odd') . '">
523  <td class="typo3-adminPanel-section-content-title">' . $label . '</td>
524  <td class="typo3-adminPanel-section-content">' . htmlspecialchars($value) . '</td>
525  </tr>';
526  }
527  $out .= $table;
528  $out = '<tr><td colspan="2"><table class="admin-panel-table">' . $out . '</table></td></tr>';
529  }
530 
531  $out = $head . $out;
532  return $out;
533  }
534 
535  /*****************************************************
536  * Admin Panel Layout Helper functions
537  ****************************************************/
547  public function extGetHead($sectionSuffix) {
548  $settingName = 'display_' . $sectionSuffix;
549  $isVisible = $GLOBALS['BE_USER']->uc['TSFE_adminConfig'][$settingName];
550  $cssClassName = 'typo3-adminPanel-section-' . ($isVisible ? 'open' : 'closed');
551  return '<tr class="typo3-adminPanel-section-title"><td colspan="2">' . $this->linkSectionHeader($sectionSuffix, $this->extGetLL($sectionSuffix), $cssClassName) . '<input type="hidden" name="TSFE_ADMIN_PANEL[' . $settingName . ']" value="' . $isVisible . '" /></td></tr>';
552  }
553 
563  public function linkSectionHeader($sectionSuffix, $sectionTitle, $className = '') {
564  $onclick = 'document.TSFE_ADMIN_PANEL_FORM[\'TSFE_ADMIN_PANEL[display_' . $sectionSuffix . ']\'].value=' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_' . $sectionSuffix] ? '0' : '1') . ';document.TSFE_ADMIN_PANEL_FORM.submit();return false;';
565  $content = '<div class="typo3-adminPanel-label">
566  <a href="javascript:void(0)" onclick="' . htmlspecialchars($onclick) . '"' . ($className ? ' class="' . htmlspecialchars($className) . '"' : '') . '>'
567  . $sectionTitle .
568  '</a>
569  </div>';
570  return $content;
571  }
572 
583  public function extGetItem($title, $content = '', $checkbox = '') {
584  $title = $title ? '<label for="' . htmlspecialchars($title) . '">' . $this->extGetLL($title) . '</label>' : '';
585  $out = '<tr class="typo3-adminPanel-itemRow">
586  <td class="typo3-adminPanel-section-content">' . $checkbox . $title . $content . '</td>
587  </tr>';
588  return $out;
589  }
590 
596  public function ext_makeToolBar() {
597  // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
598  $tsConfig = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list');
599  $tsConfig = $tsConfig['properties']['newContentWiz.']['overrideWithExtension'];
600  $newContentWizScriptPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($tsConfig) ? \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($tsConfig) . 'mod1/db_new_content_el.php' : TYPO3_mainDir . 'sysext/cms/layout/db_new_content_el.php';
601  $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
602  $langAllowed = $GLOBALS['BE_USER']->checkLanguageAccess($GLOBALS['TSFE']->sys_language_uid);
603  $id = $GLOBALS['TSFE']->id;
604  $returnUrl = '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'));
605 
606  $icon = IconUtility::getSpriteIcon('actions-document-history-open', array('title' => $this->extGetLL('edit_recordHistory', FALSE)));
607  $toolBar = '<a href="' . htmlspecialchars(TYPO3_mainDir . BackendUtility::getModuleUrl('record_history', array('element' => 'pages:' . $id)) . $returnUrl) . '#latest">' . $icon . '</a>';
608  if ($perms & 16 && $langAllowed) {
609  $params = '';
610  if ($GLOBALS['TSFE']->sys_language_uid) {
611  $params = '&sys_language_uid=' . $GLOBALS['TSFE']->sys_language_uid;
612  }
613  $icon = IconUtility::getSpriteIcon('actions-document-new', array('title' => $this->extGetLL('edit_newContentElement', FALSE)));
614  $toolBar .= '<a href="' . htmlspecialchars(($newContentWizScriptPath . '?id=' . $id . $params . '&returnUrl=' . $returnUrl)) . '">' . $icon . '</a>';
615  }
616  if ($perms & 2) {
617  $icon = IconUtility::getSpriteIcon('actions-document-move', array('title' => $this->extGetLL('edit_move_page', FALSE)));
618  $toolBar .= '<a href="' . htmlspecialchars((TYPO3_mainDir . 'move_el.php?table=pages&uid=' . $id . '&returnUrl=' . $returnUrl)) . '">' . $icon . '</a>';
619  }
620  if ($perms & 8) {
621  $icon = IconUtility::getSpriteIcon('actions-page-new', array('title' => $this->extGetLL('edit_newPage', FALSE)));
622  $toolBar .= '<a href="' . htmlspecialchars((TYPO3_mainDir . 'db_new.php?id=' . $id . '&pagesOnly=1&returnUrl=' . $returnUrl)) . '">' . $icon . '</a>';
623  }
624  if ($perms & 2) {
625  $params = '&edit[pages][' . $id . ']=edit';
626  $icon = IconUtility::getSpriteIcon('actions-document-open', array('title' => $this->extGetLL('edit_editPageProperties', FALSE)));
627  $toolBar .= '<a href="' . htmlspecialchars((TYPO3_mainDir . 'alt_doc.php?' . $params . '&noView=1&returnUrl=' . $returnUrl)) . '">' . $icon . '</a>';
628  if ($GLOBALS['TSFE']->sys_language_uid && $langAllowed) {
629  $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
630  'uid,pid,t3ver_state',
631  'pages_language_overlay',
632  'pid=' . (int)$id .
633  ' AND sys_language_uid=' . $GLOBALS['TSFE']->sys_language_uid .
634  $GLOBALS['TSFE']->sys_page->enableFields('pages_language_overlay')
635  );
636  $GLOBALS['TSFE']->sys_page->versionOL('pages_language_overlay', $row);
637  if (is_array($row)) {
638  $params = '&edit[pages_language_overlay][' . $row['uid'] . ']=edit';
639  $icon = IconUtility::getSpriteIcon('mimetypes-x-content-page-language-overlay', array('title' => $this->extGetLL('edit_editPageOverlay', FALSE)));
640  $toolBar .= '<a href="' . htmlspecialchars((TYPO3_mainDir . 'alt_doc.php?' . $params . '&noView=1&returnUrl=' . $returnUrl)) . '">' . $icon . '</a>';
641  }
642  }
643  }
644  if ($GLOBALS['BE_USER']->check('modules', 'web_list')) {
645  $urlParams = array(
646  'id' => $id,
647  'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
648  );
649  $icon = IconUtility::getSpriteIcon('actions-system-list-open', array('title' => $this->extGetLL('edit_db_list', FALSE)));
650  $toolBar .= '<a href="' . htmlspecialchars((TYPO3_mainDir . BackendUtility::getModuleUrl('web_list', $urlParams))) . '">' . $icon . '</a>';
651  }
652 
653  $toolBar = '<div class="toolbar">' . $toolBar . '</div>';
654 
655  return $toolBar;
656  }
657 
665  protected function extGetLL($key, $convertWithHtmlspecialchars = TRUE) {
666  $labelStr = $GLOBALS['LANG']->getLL($key);
667  if ($convertWithHtmlspecialchars) {
668  $labelStr = htmlspecialchars($labelStr);
669  }
670  return $labelStr;
671  }
672 
673 }
static minifyJavaScript($script, &$error='')
static skinImg($backPath, $src, $wHattribs='', $outputMode=0)
linkSectionHeader($sectionSuffix, $sectionTitle, $className='')
static getUserObj($classRef, $checkPrefix='', $silent=FALSE)
extGetFeAdminValue($sectionName, $val='')
extGetItem($title, $content='', $checkbox='')
static getModuleUrl($moduleName, $urlParameters=array(), $backPathOverride=FALSE, $returnAbsoluteUrl=FALSE)
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.
extGetLL($key, $convertWithHtmlspecialchars=TRUE)
static getSpriteIcon($iconName, array $options=array(), array $overlays=array())
static formatSize($sizeInBytes, $labels='')
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static deleteClause($table, $tableAlias='')