b833508750e9fa46bbbe2ea1fd9b6aaf1c9b9e9a
2 /***************************************************************
5 * (c) 2008 Jeff Segars <jeff@webempoweredchurch.org>
6 * (c) 2008 David Slayback <dave@webempoweredchurch.org>
9 * This script is part of the TYPO3 project. The TYPO3 project is
10 * free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * The GNU General Public License can be found at
16 * http://www.gnu.org/copyleft/gpl.html.
17 * A copy is found in the textfile GPL.txt and important notices to the license
18 * from the author is found in LICENSE.txt distributed with these scripts.
21 * This script is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * This copyright notice MUST APPEAR in all copies of the script!
27 ***************************************************************/
29 * Controller class for frontend editing.
33 * @author Jeff Segars <jeff@webempoweredchurch.org>
34 * @author David Slayback <dave@webempoweredchurch.org>
38 class t3lib_frontendedit
{
53 protected $ext_forcePreview = false;
56 * Comma separated list of page UIDs to be published.
60 protected $extPublishList = '';
63 * Creates and initializes the TCEmain object.
67 public function __construct() {
68 $this->tce
= t3lib_div
::makeInstance('t3lib_TCEmain');
69 $this->tce
->stripslashes_values
=0;
73 * Initializes configuration options.
77 public function initConfigOptions() {
78 $this->saveConfigOptions();
79 $this->TSFE_EDIT
= t3lib_div
::_POST('TSFE_EDIT');
81 // Setting some values based on the admin panel
82 $GLOBALS['TSFE']->forceTemplateParsing
= $this->extGetFeAdminValue('tsdebug', 'forceTemplateParsing');
83 $GLOBALS['TSFE']->displayEditIcons
= $this->extGetFeAdminValue('edit', 'displayIcons');
84 $GLOBALS['TSFE']->displayFieldEditIcons
= $this->extGetFeAdminValue('edit', 'displayFieldIcons');
86 if ($this->extGetFeAdminValue('tsdebug', 'displayQueries')) {
87 if ($GLOBALS['TYPO3_DB']->explainOutput
== 0) { // do not override if the value is already set in t3lib_db
88 // Enable execution of EXPLAIN SELECT queries
89 $GLOBALS['TYPO3_DB']->explainOutput
= 3;
93 if (t3lib_div
::_GP('ADMCMD_editIcons')) {
94 $GLOBALS['TSFE']->displayFieldEditIcons
=1;
95 $GLOBALS['BE_USER']->uc
['TSFE_adminConfig']['edit_editNoPopup']=1;
98 if (t3lib_div
::_GP('ADMCMD_simUser')) {
99 $GLOBALS['BE_USER']->uc
['TSFE_adminConfig']['preview_simulateUserGroup']=intval(t3lib_div
::_GP('ADMCMD_simUser'));
100 $this->ext_forcePreview
= true;
103 if (t3lib_div
::_GP('ADMCMD_simTime')) {
104 $GLOBALS['BE_USER']->uc
['TSFE_adminConfig']['preview_simulateDate']=intval(t3lib_div
::_GP('ADMCMD_simTime'));
105 $this->ext_forcePreview
= true;
108 // Include classes for editing IF editing module in Admin Panel is open
109 if (($this->isAdminModuleEnabled('edit') && $this->isAdminModuleOpen('edit')) ||
$GLOBALS['TSFE']->displayEditIcons
== 1) {
110 $GLOBALS['TSFE']->includeTCA();
111 if ($this->isEditAction()) {
112 require_once (PATH_t3lib
. 'class.t3lib_tcemain.php');
116 if ($this->isEditFormShown()) {
117 require_once(PATH_t3lib
. 'class.t3lib_tceforms.php');
118 require_once(PATH_t3lib
. 'class.t3lib_iconworks.php');
119 require_once(PATH_t3lib
. 'class.t3lib_loaddbgroup.php');
120 require_once(PATH_t3lib
. 'class.t3lib_transferdata.php');
124 if ($GLOBALS['TSFE']->forceTemplateParsing ||
$GLOBALS['TSFE']->displayEditIcons ||
$GLOBALS['TSFE']->displayFieldEditIcons
) {
125 $GLOBALS['TSFE']->set_no_cache();
131 * Delegates to the appropriate view and renders the admin panel content.
135 public function displayAdmin() {
137 $adminClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/classes/class.frontendedit.php']['admin'];
138 if ($adminClass && !$GLOBALS['BE_USER']->extAdminConfig
['hide']) {
139 $admin = &t3lib_div
::getUserObj($adminClass);
140 if (is_object($admin)) {
141 $content = $admin->display();
149 * Generates the "edit panels" which can be shown for a page or records on a page when the Admin Panel is enabled for a backend users surfing the frontend.
150 * With the "edit panel" the user will see buttons with links to editing, moving, hiding, deleting the element
151 * This function is used for the cObject EDITPANEL and the stdWrap property ".editPanel"
153 * @param string A content string containing the content related to the edit panel. For cObject "EDITPANEL" this is empty but not so for the stdWrap property. The edit panel is appended to this string and returned.
154 * @param array TypoScript configuration properties for the editPanel
155 * @param string The "table:uid" of the record being shown. If empty string then $this->currentRecord is used. For new records (set by $conf['newRecordFromTable']) it's auto-generated to "[tablename]:NEW"
156 * @param array Alternative data array to use. Default is $this->data
157 * @return string The input content string with the editPanel appended. This function returns only an edit panel appended to the content string if a backend user is logged in (and has the correct permissions). Otherwise the content string is directly returned.
158 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=375&cHash=7d8915d508
160 public function displayEditPanel($content, array $conf, $currentRecord, array $dataArray) {
161 if ($conf['newRecordFromTable']) {
162 $currentRecord = $conf['newRecordFromTable'] . ':NEW';
163 $conf['allow'] = 'new';
166 list($table, $uid) = explode(':', $currentRecord);
168 // Page ID for new records, 0 if not specified
169 $newRecordPid = intval($conf['newRecordInPid']);
170 if (!$conf['onlyCurrentPid'] ||
$dataArray['pid'] == $GLOBALS['TSFE']->id
) {
171 if ($table=='pages') {
174 if ($conf['newRecordFromTable']) {
175 $newUid = $GLOBALS['TSFE']->id
;
177 $newUid = $newRecordPid;
185 if ($GLOBALS['TSFE']->displayEditIcons
&& $table && $this->allowedToEdit($table, $dataArray, $conf) && $this->allowedToEditLanguage($table, $dataArray)) {
186 $editClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/classes/class.frontendedit.php']['edit'];
188 $edit = &t3lib_div
::getUserObj($editClass, false);
189 if (is_object($edit)) {
190 $allowedActions = $this->getAllowedEditActions($table, $conf, $dataArray['pid']);
191 $content = $edit->editPanel($content, $conf, $currentRecord, $dataArray, $table, $allowedActions, $newUid, $this->getHiddenFieldArray($dataArray));
200 * Gets the hidden fields (array key=field name, value=field value) to be used in the edit panel for a particular content element.
201 * In the normal case, no hidden fields are needed but special controllers such as TemplaVoila need to track flexform pointers, etc.
203 * @param array The data array for a specific content element.
206 public function getHiddenFieldArray(array $dataArray) {
207 // No special hidden fields needed.
212 * Adds an edit icon to the content string. The edit icon links to alt_doc.php with proper parameters for editing the table/fields of the context.
213 * This implements TYPO3 context sensitive editing facilities. Only backend users will have access (if properly configured as well).
215 * @param string The content to which the edit icons should be appended
216 * @param string The parameters defining which table and fields to edit. Syntax is [tablename]:[fieldname],[fieldname],[fieldname],... OR [fieldname],[fieldname],[fieldname],... (basically "[tablename]:" is optional, default table is the one of the "current record" used in the function). The fieldlist is sent as "&columnsOnly=" parameter to alt_doc.php
217 * @param array TypoScript properties for configuring the edit icons.
218 * @param string The "table:uid" of the record being shown. If empty string then $this->currentRecord is used. For new records (set by $conf['newRecordFromTable']) it's auto-generated to "[tablename]:NEW"
219 * @param array Alternative data array to use. Default is $this->data
220 * @param string Additional URL parameters for the link pointing to alt_doc.php
221 * @return string The input content string, possibly with edit icons added (not necessarily in the end but just after the last string of normal content.
224 public function displayEditIcons($content, $params, array $conf=array(), $currentRecord = '', array $dataArray = array(), $addUrlParamStr = '') {
225 // Check incoming params:
226 list($currentRecordTable, $currentRecordUID) = explode(':', $currentRecord);
227 list($fieldList, $table) = array_reverse(t3lib_div
::trimExplode(':', $params, 1)); // Reverse the array because table is optional
229 $table = $currentRecordTable;
230 } elseif ($table != $currentRecordTable) {
231 return $content; // If the table is set as the first parameter, and does not match the table of the current record, then just return.
234 $editUid = $dataArray['_LOCALIZED_UID'] ?
$dataArray['_LOCALIZED_UID'] : $currentRecordUID;
236 // Edit icons imply that the editing action is generally allowed, assuming page and content element permissions permit it.
237 if(!array_key_exists('allow', $conf)) {
238 $conf['allow'] = 'edit';
241 if ($GLOBALS['TSFE']->displayFieldEditIcons
&& $table && $this->allowedToEdit($table, $dataArray, $conf) && $fieldList && $this->allowedToEditLanguage($table, $dataArray)) {
242 $editClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/classes/class.frontendedit.php']['edit'];
244 $edit = &t3lib_div
::getUserObj($editClass);
245 if (is_object($edit)) {
246 $content = $edit->editIcons($content, $params, $conf, $currentRecord, $dataArray, $addURLParamStr, $table, $editUid, $fieldList);
255 * Checks if a Admin Panel section ("module") is available for the user. If so, true is returned.
257 * @param string The module key, eg. "edit", "preview", "info" etc.
260 public function isAdminModuleEnabled($key) {
261 // Returns true if the module checked is "preview" and the forcePreview flag is set.
262 if ($key=='preview' && $this->ext_forcePreview
) {
266 // If key is not set, only "all" is checked
267 if ($GLOBALS['BE_USER']->extAdminConfig
['enable.']['all']) {
271 if ($GLOBALS['BE_USER']->extAdminConfig
['enable.'][$key]) {
277 * Saves any change in settings made in the Admin Panel.
278 * Called from index_ts.php right after access check for the Admin Panel
282 public function saveConfigOptions() {
283 $input = t3lib_div
::_GP('TSFE_ADMIN_PANEL');
284 if (is_array($input)) {
286 $GLOBALS['BE_USER']->uc
['TSFE_adminConfig'] = array_merge(!is_array($GLOBALS['BE_USER']->uc
['TSFE_adminConfig']) ?
array() : $GLOBALS['BE_USER']->uc
['TSFE_adminConfig'], $input); // Candidate for t3lib_div::array_merge() if integer-keys will some day make trouble...
287 unset($GLOBALS['BE_USER']->uc
['TSFE_adminConfig']['action']);
290 if ($input['action']['clearCache'] && $this->isAdminModuleEnabled('cache')) {
291 $GLOBALS['BE_USER']->extPageInTreeInfo
=array();
292 $theStartId = intval($input['cache_clearCacheId']);
293 $GLOBALS['TSFE']->clearPageCacheContent_pidList($GLOBALS['BE_USER']->extGetTreeList($theStartId, $this->extGetFeAdminValue('cache', 'clearCacheLevels'), 0, $GLOBALS['BE_USER']->getPagePermsClause(1)) . $theStartId);
295 if ($input['action']['publish'] && $this->isAdminModuleEnabled('publish')) {
296 $theStartId = intval($input['publish_id']);
297 $this->extPublishList
= $GLOBALS['BE_USER']->extGetTreeList($theStartId, $this->extGetFeAdminValue('publish', 'levels'), 0, $GLOBALS['BE_USER']->getPagePermsClause(1)) . $theStartId;
301 $GLOBALS['BE_USER']->writeUC();
303 $GLOBALS['TT']->LR
= $this->extGetFeAdminValue('tsdebug', 'LR');
305 if ($this->extGetFeAdminValue('cache', 'noCache')) {
306 $GLOBALS['TSFE']->set_no_cache();
309 // Hook for post processing the frontend admin configuration. Added with TYPO3 4.2, so naming is now incorrect but preserves compatibility.
310 // @deprecated since TYPO3 4.3
311 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extSaveFeAdminConfig-postProc'])) {
312 $_params = array('input' => &$input, 'pObj' => &$this);
313 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extSaveFeAdminConfig-postProc'] as $_funcRef) {
314 t3lib_div
::callUserFunction($_funcRef, $_params, $this);
320 * Returns the value for a Admin Panel setting. You must specify both the module-key and the internal setting key.
322 * @param string Module key
323 * @param string Setting key
324 * @return string The setting value
326 public function extGetFeAdminValue($pre, $val='') {
327 // Check if module is enabled.
328 if ($this->isAdminModuleEnabled($pre)) {
329 // Exceptions where the values can be overridden from backend:
331 if ($pre . '_' . $val == 'edit_displayIcons' && $GLOBALS['BE_USER']->extAdminConfig
['module.']['edit.']['forceDisplayIcons']) {
334 if ($pre . '_' . $val == 'edit_displayFieldIcons' && $GLOBALS['BE_USER']->extAdminConfig
['module.']['edit.']['forceDisplayFieldIcons']) {
338 // override all settings with user TSconfig
339 if ($GLOBALS['BE_USER']->extAdminConfig
['override.'][$pre . '.'][$val] && $val) {
340 return $GLOBALS['BE_USER']->extAdminConfig
['override.'][$pre . '.'][$val];
342 if ($GLOBALS['BE_USER']->extAdminConfig
['override.'][$pre]) {
343 return $GLOBALS['BE_USER']->extAdminConfig
['override.'][$pre];
346 $retVal = $val ?
$GLOBALS['BE_USER']->uc
['TSFE_adminConfig'][$pre . '_' . $val] : 1;
348 if ($pre=='preview' && $this->ext_forcePreview
) {
356 if ($this->isAdminModuleOpen($pre)) { // See if the menu is expanded!
360 // Hook for post processing the frontend admin configuration. Added with TYPO3 4.2, so naming is now incorrect but preserves compatibility.
361 // @deprecated since TYPO3 4.3
362 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction-postProc'])) {
363 $_params = array('cmd' => &$cmd, 'tce' => &$this->tce
, 'pObj' => &$this);
364 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction-postProc'] as $_funcRef) {
365 t3lib_div
::callUserFunction($_funcRef, $_params, $this);
372 * Returns the comma-separated list of page UIDs to be published.
376 public function getExtPublishList() {
377 return $this->extPublishList
;
381 * Returns true if admin panel module is open
383 * @param string Module key
384 * @return boolean True, if the admin panel is open for the specified admin panel module key.
386 public function isAdminModuleOpen($pre) {
387 return $GLOBALS['BE_USER']->uc
['TSFE_adminConfig']['display_top'] && $GLOBALS['BE_USER']->uc
['TSFE_adminConfig']['display_' . $pre];
390 /*****************************************************
394 ****************************************************/
397 * Returns true in an edit-action is sent from the Admin Panel
402 public function isEditAction() {
403 if (is_array($this->TSFE_EDIT
)) {
404 if ($this->TSFE_EDIT
['cancel']) {
405 unset($this->TSFE_EDIT
['cmd']);
407 $cmd = (string) $this->TSFE_EDIT
['cmd'];
408 if (($cmd != 'edit' ||
(is_array($this->TSFE_EDIT
['data']) && ($this->TSFE_EDIT
['update'] ||
$this->TSFE_EDIT
['update_close']))) && $cmd != 'new') {
409 // $cmd can be a command like "hide" or "move". If $cmd is "edit" or "new" it's an indication to show the formfields. But if data is sent with update-flag then $cmd = edit is accepted because edit may be sendt because of .keepGoing flag.
418 * Returns true if an edit form is shown on the page.
419 * Used from index_ts.php where a true return-value will result in classes etc. being included.
424 public function isEditFormShown() {
425 if (is_array($this->TSFE_EDIT
)) {
426 $cmd = (string) $this->TSFE_EDIT
['cmd'];
427 if ($cmd=='edit' ||
$cmd=='new') {
434 * Management of the on-page frontend editing forms and edit panels.
435 * Basically taking in the data and commands and passes them on to the proper classes as they should be.
438 * @throws UnexpectedValueException if TSFE_EDIT[cmd] is not a valid command
441 public function editAction() {
443 list($table, $uid) = explode(':', $this->TSFE_EDIT
['record']);
444 $cmd = $this->TSFE_EDIT
['cmd'];
446 if ($cmd && $table && $uid && isset($GLOBALS['TCA'][$table])) {
447 // Hook for defining custom editing actions. Naming is incorrect, but preserves compatibility.
448 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction'])) {
450 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction'] as $_funcRef) {
451 t3lib_div
::callUserFunction($_funcRef, $_params, $this);
454 // Perform the requested editing command.
455 if(is_callable(array($this, $cmd))) {
456 $this->$cmd($table, $uid);
458 throw new UnexpectedValueException(
459 'The specified frontend edit command (' . $cmd . ') is not valid.',
465 if (($this->TSFE_EDIT
['doSave'] ||
$this->TSFE_EDIT
['update'] ||
$this->TSFE_EDIT
['update_close']) && is_array($this->TSFE_EDIT
['data'])) {
466 $this->save($this->TSFE_EDIT
['data']);
467 // pass this on if needed
468 if ($newuid = $this->tce
->substNEWwithIDs
['NEW']) {
469 $this->TSFE_EDIT
['newUID'] = $newuid;
475 * Hides a specific record.
477 * @param string The table name for the record to hide.
478 * @param integer The UID for the record to hide.
481 public function hide($table, $uid) {
482 $hideField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
485 $recData[$table][$uid][$hideField] = 1;
486 $this->tce
->start($recData, array());
487 $this->tce
->process_datamap();
492 * Unhides (shows) a specific record.
494 * @param string The table name for the record to unhide.
495 * @param integer The UID for the record to unhide.
498 public function unhide($table, $uid) {
499 $hideField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
502 $recData[$table][$uid][$hideField] = 0;
503 $this->tce
->start($recData, array());
504 $this->tce
->process_datamap();
511 * @param string The table name for the record to move.
512 * @param integer The UID for the record to hide.
515 public function up($table, $uid) {
516 $this->move($table, $uid, 'up');
520 * Moves a record down.
522 * @param string The table name for the record to move.
523 * @param integer The UID for the record to move.
526 public function down($table, $uid) {
527 $this->move($table, $uid, 'down');
531 * Moves a record in the specified direction.
533 * @param string The table name for the record to move.
534 * @param integer The UID for the record to move.
535 * @param string The direction to move, either 'up' or 'down'.
538 protected function move($table, $uid, $direction) {
540 if ($direction == 'up') {
548 $sortField = $GLOBALS['TCA'][$table]['ctrl']['sortby'];
551 $fields = array_unique(t3lib_div
::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['copyAfterDuplFields'] . ',uid,pid,' . $sortField, true));
552 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(implode(',', $fields), $table, 'uid=' . $uid);
553 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
554 // record before or after
555 $preview = $this->extGetFeAdminValue('preview');
556 $copyAfterFieldsQuery = '';
558 $ignore = array('starttime'=>1, 'endtime'=>1, 'disabled'=>1, 'fe_group'=>1);
560 if ($GLOBALS['TCA'][$table]['ctrl']['copyAfterDuplFields']) {
561 $cAFields = t3lib_div
::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['copyAfterDuplFields'], false);
562 foreach($cAFields as $fieldName) {
563 $copyAfterFieldsQuery .= ' AND ' . $fieldName . '="' . $row[$fieldName] . '"';
567 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
570 'pid=' . intval($row['pid']) .
571 ' AND ' . $sortField . $operator . intval($row[$sortField]) .
572 $copyAfterFieldsQuery .
573 $GLOBALS['TSFE']->sys_page
->enableFields($table, '', $ignore),
575 $sortField . ' ' . $order,
578 if ($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
579 if ($direction == 'down') {
580 $cmdData[$table][$uid]['move'] = -$row2['uid'];
581 } elseif ($row3 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // Must take the second record above...
582 $cmdData[$table][$uid]['move'] = -$row3['uid'];
583 } else { // ... and if that does not exist, use pid
584 $cmdData[$table][$uid]['move'] = $row['pid'];
586 } elseif ($direction == 'up') {
587 $cmdData[$table][$uid]['move'] = $row['pid'];
590 if (count($cmdData)) {
591 $this->tce
->start(array(), $cmdData);
592 $this->tce
->process_cmdmap();
598 * Deletes a specific record.
600 * @param string The table name for the record to delete.
601 * @param integer The UID for the record to delete.
604 public function delete($table, $uid) {
605 $cmdData[$table][$uid]['delete'] = 1;
606 if (count($cmdData)) {
607 $this->tce
->start(array(), $cmdData);
608 $this->tce
->process_cmdmap();
613 * Saves a record based on its data array.
615 * @param array Array of record data to be saved.
618 public function save(array $data) {
619 $this->tce
->start($data, array());
620 $this->tce
->process_uploads($_FILES);
621 $this->tce
->process_datamap();
625 * Checks whether the user has access to edit the language for the
628 * @param string The name of the table.
629 * @param array The record.
632 protected function allowedToEditLanguage($table, array $currentRecord) {
633 // If no access right to record languages, return immediately
634 if ($table === 'pages') {
635 $lang = $GLOBALS['TSFE']->sys_language_uid
;
636 } elseif ($table === 'tt_content') {
637 $lang = $GLOBALS['TSFE']->sys_language_content
;
638 } elseif ($GLOBALS['TCA'][$table]['ctrl']['languageField']) {
639 $lang = $currentRecord[$GLOBALS['TCA'][$table]['ctrl']['languageField']];
644 if ($GLOBALS['BE_USER']->checkLanguageAccess($lang)) {
645 $languageAccess = true;
647 $languageAccess = false;
650 return $languageAccess;
654 * Checks whether the user is allowed to edit the requested table.
656 * @param string The name of the table.
657 * @param array The data array.
658 * @param array The configuration array for the edit panel.
661 protected function allowedToEdit($table, array $dataArray, array $conf) {
663 // Unless permissions specifically allow it, editing is not allowed.
666 if ($table=='pages') {
667 // 2 = permission to edit the page
668 if($GLOBALS['BE_USER']->isAdmin() ||
$GLOBALS['BE_USER']->doesUserHaveAccess($dataArray, 2)) {
672 // 16 = permission to edit content on the page
673 if ($GLOBALS['BE_USER']->isAdmin() ||
$GLOBALS['BE_USER']->doesUserHaveAccess(t3lib_BEfunc
::getRecord('pages', $dataArray['pid']), 16)) {
678 if (!$conf['onlyCurrentPid'] ||
($dataArray['pid'] == $GLOBALS['TSFE']->id
)) {
680 $types = t3lib_div
::trimExplode(',', t3lib_div
::strtolower($conf['allow']),1);
681 $allow = array_flip($types);
683 $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page
);
684 if ($table == 'pages') {
685 $allow = $this->getAllowedEditActions($table, $conf, $dataArray['pid'], $allow);
687 // Can only display editbox if there are options in the menu
692 $mayEdit = count($allow) && ($perms & 16);
700 * Takes an array of generally allowed actions and filters that list based on page and content permissions.
702 * @param string The name of the table.
703 * @param array The configuration array.
704 * @param integer The PID where editing will occur.
705 * @param string Comma-separated list of actions that are allowed in general.
708 protected function getAllowedEditActions($table, array $conf, $pid, $allow = '') {
711 $types = t3lib_div
::trimExplode(',', t3lib_div
::strtolower($conf['allow']), true);
712 $allow = array_flip($types);
715 if (!$conf['onlyCurrentPid'] ||
$pid == $GLOBALS['TSFE']->id
) {
717 $types = t3lib_div
::trimExplode(',', t3lib_div
::strtolower($conf['allow']), true);
718 $allow = array_flip($types);
720 $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page
);
721 if ($table=='pages') {
723 if (count($GLOBALS['TSFE']->config
['rootLine']) == 1) {
724 unset($allow['move']);
725 unset($allow['hide']);
726 unset($allow['delete']);
729 unset($allow['edit']);
730 unset($allow['move']);
731 unset($allow['hide']);
734 unset($allow['delete']);
737 unset($allow['new']);
746 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['t3lib/class.t3lib_frontendedit.php']) {
747 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['t3lib/class.t3lib_frontendedit.php']);