88 protected function init() {
93 if ($fileIdentifier) {
97 if (!$this->fileObject) {
98 $title =
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', TRUE);
99 $message =
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', TRUE);
100 throw new \RuntimeException(
$title .
': ' . $message, 1294586841);
102 if ($this->fileObject->getStorage()->getUid() === 0) {
103 throw new \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException(
'You are not allowed to access files outside your storages', 1375889832);
108 $this->title = $icon . htmlspecialchars($this->fileObject->getStorage()->getName()) .
': ' . htmlspecialchars($this->fileObject->getIdentifier());
112 $this->doc->setModuleTemplate(
'EXT:backend/Resources/Private/Templates/file_edit.html');
113 $this->doc->backPath =
$GLOBALS[
'BACK_PATH'];
114 $this->doc->JScode = $this->doc->wrapScriptTags(
' 115 function backToList() { // 116 top.goToModule("file_list"); 119 $this->doc->form =
'<form action="tce_file.php" method="post" name="editform">';
129 $this->content = $this->doc->startPage(
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:file_edit.php.pagetitle'));
131 if (isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'typo3/file_edit.php'][
'preOutputProcessingHook'])) {
132 $preOutputProcessingHook = &
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'typo3/file_edit.php'][
'preOutputProcessingHook'];
133 if (is_array($preOutputProcessingHook)) {
134 $hookParameters = array(
135 'content' => &$this->content,
136 'target' => &$this->target
138 foreach ($preOutputProcessingHook as $hookFunction) {
143 $pageContent = $this->doc->header(
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:file_edit.php.pagetitle') .
' ' . htmlspecialchars($this->fileObject->getName()));
144 $pageContent .= $this->doc->spacer(2);
146 $extList =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'textfile_ext'];
149 throw new \Exception(
'Files with that extension are not editable.');
152 $fileContent = $this->fileObject->getContents();
154 $hValue =
'file_edit.php?target=' . rawurlencode($this->origTarget) .
'&returnUrl=' . rawurlencode($this->returnUrl);
158 <textarea rows="30" name="file[editfile][0][data]" wrap="off"' . $this->doc->formWidth(48, TRUE,
'width:98%;height:80%') .
' class="fixed-font enable-tab">' .
GeneralUtility::formatForTextarea($fileContent) .
'</textarea> 159 <input type="hidden" name="file[editfile][0][target]" value="' . $this->fileObject->getUid() .
'" /> 160 <input type="hidden" name="redirect" value="' . htmlspecialchars($hValue) .
'" /> 165 if (
$GLOBALS[
'BE_USER']->mayMakeShortcut()) {
166 $this->MCONF[
'name'] =
'xMOD_file_edit.php';
167 $docHeaderButtons[
'shortcut'] = $this->doc->makeShortcutIcon(
'target',
'', $this->MCONF[
'name'], 1);
169 $docHeaderButtons[
'shortcut'] =
'';
171 }
catch (\Exception $e) {
172 $code .= sprintf(
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:file_edit.php.coundNot'), $extList);
175 $pageContent .= $this->doc->sectionEnd();
176 $pageContent .= $code;
178 if (isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'typo3/file_edit.php'][
'postOutputProcessingHook'])) {
179 $postOutputProcessingHook = &
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'typo3/file_edit.php'][
'postOutputProcessingHook'];
180 if (is_array($postOutputProcessingHook)) {
181 $hookParameters = array(
182 'pageContent' => &$pageContent,
183 'target' => &$this->target
185 foreach ($postOutputProcessingHook as $hookFunction) {
191 $markerArray = array(
192 'CSH' => $docHeaderButtons[
'csh'],
193 'FUNC_MENU' =>
BackendUtility::getFuncMenu($this->
id,
'SET[function]', $this->MOD_SETTINGS[
'function'], $this->MOD_MENU[
'function']),
194 'BUTTONS' => $docHeaderButtons,
195 'PATH' => $this->title,
196 'CONTENT' => $pageContent
198 $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
199 $this->content .= $this->doc->endPage();
200 $this->content = $this->doc->insertStylesAndJS($this->content);
224 $buttons[
'SAVE'] =
'<a href="#" onclick="document.editform.submit();" title="' .
$GLOBALS[
'LANG']->makeEntities(
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:file_edit.php.submit', TRUE)) .
'">' . $theIcon .
'</a>';
227 $buttons[
'SAVE_CLOSE'] =
'<a href="#" onclick="document.editform.redirect.value=\'' . htmlspecialchars($this->returnUrl) .
'\'; document.editform.submit();
" title="' . $GLOBALS['LANG
']->makeEntities($GLOBALS['LANG
']->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.saveAndClose
', TRUE)) . '">' . $theIcon . '</a>'; 229 $theIcon = IconUtility::getSpriteIcon('actions-document-close'); 230 $buttons['CANCEL'] = '<a href="#
" onclick="backToList();
return false;
" title="' . $GLOBALS['LANG
']->makeEntities($GLOBALS['LANG
']->sL('LLL:EXT:lang/locallang_core.xlf:labels.cancel
', TRUE)) . '">' . $theIcon . '</a>';
static formatForTextarea($content)
static cshItem($table, $field, $BACK_PATH, $wrap='', $onlyIconMode=FALSE, $styleAttrib='')
static makeInstance($className)
static callUserFunction($funcName, &$params, &$ref, $checkPrefix='', $errorMode=0)
static getSpriteIcon($iconName, array $options=array(), array $overlays=array())
static getFuncMenu($mainParams, $elementName, $currentValue, $menuItems, $script='', $addparams='')
static sanitizeLocalUrl($url='')
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static inList($list, $item)