45 if (
$GLOBALS[
'BE_USER']->isFrontendEditingActive()) {
63 public function displayEditPanel($content, array $conf, $currentRecord, array $dataArray) {
64 if ($conf[
'newRecordFromTable']) {
65 $currentRecord = $conf[
'newRecordFromTable'] .
':NEW';
66 $conf[
'allow'] =
'new';
67 $checkEditAccessInternals = FALSE;
69 $checkEditAccessInternals = TRUE;
71 list($table,
$uid) = explode(
':', $currentRecord);
73 $newRecordPid = (int)$conf[
'newRecordInPid'];
74 if (!$conf[
'onlyCurrentPid'] || $dataArray[
'pid'] ==
$GLOBALS[
'TSFE']->
id) {
75 if ($table ==
'pages') {
78 if ($conf[
'newRecordFromTable']) {
81 $newUid = $newRecordPid;
89 $editClass =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'typo3/classes/class.frontendedit.php'][
'edit'];
92 if (is_object($edit)) {
94 $content = $edit->editPanel($content, $conf, $currentRecord, $dataArray, $table, $allowedActions, $newUid, $this->
getHiddenFields($dataArray));
113 public function displayEditIcons($content, $params, array $conf = array(), $currentRecord =
'', array $dataArray = array(), $addUrlParamStr =
'') {
115 list($currentRecordTable, $currentRecordUID) = explode(
':', $currentRecord);
116 list($fieldList, $table) = array_reverse(\
TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(
':', $params, TRUE));
119 $table = $currentRecordTable;
120 } elseif ($table != $currentRecordTable) {
124 $editUid = $dataArray[
'_LOCALIZED_UID'] ?: $currentRecordUID;
126 if (!array_key_exists(
'allow', $conf)) {
127 $conf[
'allow'] =
'edit';
130 $editClass =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'typo3/classes/class.frontendedit.php'][
'edit'];
133 if (is_object($edit)) {
134 $content = $edit->editIcons($content, $params, $conf, $currentRecord, $dataArray, $addUrlParamStr, $table, $editUid, $fieldList);
153 if (is_array($this->TSFE_EDIT)) {
154 if ($this->TSFE_EDIT[
'cancel']) {
155 unset($this->TSFE_EDIT[
'cmd']);
157 $cmd = (string) $this->TSFE_EDIT[
'cmd'];
158 if (($cmd !=
'edit' || is_array($this->TSFE_EDIT[
'data']) && ($this->TSFE_EDIT[
'doSave'] || $this->TSFE_EDIT[
'update'] || $this->TSFE_EDIT[
'update_close'])) && $cmd !=
'new') {
175 if (is_array($this->TSFE_EDIT)) {
176 $cmd = (string) $this->TSFE_EDIT[
'cmd'];
177 if ($cmd ==
'edit' || $cmd ==
'new') {
193 list($table,
$uid) = explode(
':', $this->TSFE_EDIT[
'record']);
195 $cmd = $this->TSFE_EDIT[
'cmd'];
197 if (($this->TSFE_EDIT[
'doSave'] || $this->TSFE_EDIT[
'update'] || $this->TSFE_EDIT[
'update_close']) && is_array($this->TSFE_EDIT[
'data'])) {
200 if ($cmd ==
'save' || $cmd && $table &&
$uid && isset(
$GLOBALS[
'TCA'][$table])) {
202 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_tsfebeuserauth.php'][
'extEditAction'])) {
204 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_tsfebeuserauth.php'][
'extEditAction'] as $_funcRef) {
209 $cmdAction =
'do' . ucwords($cmd);
210 if (is_callable(array($this, $cmdAction))) {
211 $this->{$cmdAction}($table,
$uid);
213 throw new \UnexpectedValueException(
'The specified frontend edit command (' . $cmd .
') is not valid.', 1225818120);
226 $hideField =
$GLOBALS[
'TCA'][$table][
'ctrl'][
'enablecolumns'][
'disabled'];
229 $recData[$table][
$uid][$hideField] = 1;
231 $this->tce->start($recData, array());
232 $this->tce->process_datamap();
244 $hideField =
$GLOBALS[
'TCA'][$table][
'ctrl'][
'enablecolumns'][
'disabled'];
247 $recData[$table][
$uid][$hideField] = 0;
249 $this->tce->start($recData, array());
250 $this->tce->process_datamap();
284 $afterUID =
$GLOBALS[
'BE_USER']->frontendEdit->TSFE_EDIT[
'moveAfter'];
285 $this->
move($table,
$uid,
'', $afterUID);
297 protected function move($table,
$uid, $direction =
'', $afterUID = 0) {
299 $sortField =
$GLOBALS[
'TCA'][$table][
'ctrl'][
'sortby'];
302 $fields = array_unique(\
TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(
',',
$GLOBALS[
'TCA'][$table][
'ctrl'][
'copyAfterDuplFields'] .
',uid,pid,' . $sortField, TRUE));
303 $res =
$GLOBALS[
'TYPO3_DB']->exec_SELECTquery(implode(
',', $fields), $table,
'uid=' .
$uid);
304 if ($row =
$GLOBALS[
'TYPO3_DB']->sql_fetch_assoc($res)) {
306 if (
$GLOBALS[
'BE_USER']->adminPanel instanceof \
TYPO3\CMS\Frontend\View\AdminPanelView &&
$GLOBALS[
'BE_USER']->adminPanel->extGetFeAdminValue(
'preview')) {
307 $ignore = array(
'starttime' => 1,
'endtime' => 1,
'disabled' => 1,
'fe_group' => 1);
309 $copyAfterFieldsQuery =
'';
310 if (
$GLOBALS[
'TCA'][$table][
'ctrl'][
'copyAfterDuplFields']) {
312 foreach ($cAFields as $fieldName) {
313 $copyAfterFieldsQuery .=
' AND ' . $fieldName .
'="' . $row[$fieldName] .
'"';
316 if (!empty($direction)) {
317 if ($direction ==
'up') {
324 $sortCheck =
' AND ' . $sortField . $operator . (int)$row[$sortField];
326 $GLOBALS[
'TYPO3_DB']->sql_free_result($res);
327 $res =
$GLOBALS[
'TYPO3_DB']->exec_SELECTquery(
'uid,pid', $table,
'pid=' . (
int)$row[
'pid'] . $sortCheck . $copyAfterFieldsQuery .
$GLOBALS[
'TSFE']->sys_page->enableFields($table,
'', $ignore),
'', $sortField .
' ' . $order,
'2');
328 if ($row2 =
$GLOBALS[
'TYPO3_DB']->sql_fetch_assoc($res)) {
330 $cmdData[$table][
$uid][
'move'] = -$afterUID;
331 } elseif ($direction ==
'down') {
332 $cmdData[$table][
$uid][
'move'] = -$row2[
'uid'];
333 } elseif ($row3 =
$GLOBALS[
'TYPO3_DB']->sql_fetch_assoc($res)) {
335 $cmdData[$table][
$uid][
'move'] = -$row3[
'uid'];
338 $cmdData[$table][
$uid][
'move'] = $row[
'pid'];
340 } elseif ($direction ==
'up') {
341 $cmdData[$table][
$uid][
'move'] = $row[
'pid'];
343 $GLOBALS[
'TYPO3_DB']->sql_free_result($res);
345 if (!empty($cmdData)) {
347 $this->tce->start(array(), $cmdData);
348 $this->tce->process_cmdmap();
361 $cmdData[$table][
$uid][
'delete'] = 1;
362 if (count($cmdData)) {
364 $this->tce->start(array(), $cmdData);
365 $this->tce->process_cmdmap();
377 $data = $this->TSFE_EDIT[
'data'];
380 $this->tce->start($data, array());
381 $this->tce->process_uploads($_FILES);
382 $this->tce->process_datamap();
384 $newUID = $this->tce->substNEWwithIDs[
'NEW'];
386 $GLOBALS[
'BE_USER']->frontendEdit->TSFE_EDIT[
'newUID'] = $newUID;
425 if ($table ===
'pages') {
426 $lang =
$GLOBALS[
'TSFE']->sys_language_uid;
427 } elseif ($table ===
'tt_content') {
428 $lang =
$GLOBALS[
'TSFE']->sys_language_content;
429 } elseif (
$GLOBALS[
'TCA'][$table][
'ctrl'][
'languageField']) {
430 $lang = $currentRecord[
$GLOBALS[
'TCA'][$table][
'ctrl'][
'languageField']];
434 if (
$GLOBALS[
'BE_USER']->checkLanguageAccess($lang)) {
435 $languageAccess = TRUE;
437 $languageAccess = FALSE;
439 return $languageAccess;
451 protected function allowedToEdit($table, array $dataArray, array $conf, $checkEditAccessInternals = TRUE) {
454 if ($checkEditAccessInternals) {
455 $editAccessInternals =
$GLOBALS[
'BE_USER']->recordEditAccessInternals($table, $dataArray, FALSE, FALSE);
457 $editAccessInternals = TRUE;
459 if ($editAccessInternals) {
460 if ($table ==
'pages') {
462 if (
$GLOBALS[
'BE_USER']->isAdmin() ||
$GLOBALS[
'BE_USER']->doesUserHaveAccess($dataArray, 2)) {
467 if (
$GLOBALS[
'BE_USER']->isAdmin() ||
$GLOBALS[
'BE_USER']->doesUserHaveAccess(\
TYPO3\CMS\Backend\Utility\BackendUtility::getRecord(
'pages', $dataArray[
'pid']), 16)) {
471 if (!$conf[
'onlyCurrentPid'] || $dataArray[
'pid'] ==
$GLOBALS[
'TSFE']->
id) {
474 $allow = array_flip($types);
476 if ($table ==
'pages') {
483 $mayEdit = count($allow) && $perms & 16;
502 $allow = array_flip($types);
504 if (!$conf[
'onlyCurrentPid'] || $pid ==
$GLOBALS[
'TSFE']->
id) {
507 $allow = array_flip($types);
509 if ($table ==
'pages') {
511 if (count(
$GLOBALS[
'TSFE']->config[
'rootLine']) == 1) {
512 unset($allow[
'move']);
513 unset($allow[
'hide']);
514 unset($allow[
'delete']);
517 unset($allow[
'edit']);
518 unset($allow[
'move']);
519 unset($allow[
'hide']);
522 unset($allow[
'delete']);
525 unset($allow[
'new']);
560 if (!isset($this->tce)) {
562 $this->tce->stripslashes_values = 0;
getHiddenFields(array $dataArray)
displayEditPanel($content, array $conf, $currentRecord, array $dataArray)
doMoveAfter($table, $uid)
allowedToEditLanguage($table, array $currentRecord)
static getUserObj($classRef, $checkPrefix='', $silent=FALSE)
static makeInstance($className)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
doSaveAndClose($table, $uid)
static callUserFunction($funcName, &$params, &$ref, $checkPrefix='', $errorMode=0)
getAllowedEditActions($table, array $conf, $pid, $allow='')
displayEditIcons($content, $params, array $conf=array(), $currentRecord='', array $dataArray=array(), $addUrlParamStr='')
move($table, $uid, $direction='', $afterUID=0)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
allowedToEdit($table, array $dataArray, array $conf, $checkEditAccessInternals=TRUE)