00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00051 $BACK_PATH = '';
00052 require('init.php');
00053 require('template.php');
00054 require_once(PATH_t3lib.'class.t3lib_basicfilefunc.php');
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00074 class SC_file_edit {
00075 var $content;
00076 var $basicff;
00077 var $shortPath;
00078 var $title;
00079 var $icon;
00080 var $doc;
00081
00082
00083 var $origTarget;
00084 var $target;
00085 var $returnUrl;
00086
00087
00093 function init() {
00094 global $BACK_PATH,$TYPO3_CONF_VARS;
00095
00096
00097 $this->target = $this->origTarget = t3lib_div::_GP('target');
00098 $this->returnUrl = t3lib_div::_GP('returnUrl');
00099
00100
00101 $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
00102 $this->basicff->init($GLOBALS['FILEMOUNTS'],$TYPO3_CONF_VARS['BE']['fileExtensions']);
00103
00104
00105 if (@file_exists($this->target)) {
00106 $this->target=$this->basicff->cleanDirectoryName($this->target);
00107 } else {
00108 $this->target='';
00109 }
00110 $key=$this->basicff->checkPathAgainstMounts($this->target.'/');
00111 if (!$this->target || !$key) {
00112 t3lib_BEfunc::typo3PrintError ('Parameter Error','Target was not a directory!','');
00113 exit;
00114 }
00115
00116 switch($GLOBALS['FILEMOUNTS'][$key]['type']) {
00117 case 'user': $this->icon = 'gfx/i/_icon_ftp_user.gif'; break;
00118 case 'group': $this->icon = 'gfx/i/_icon_ftp_group.gif'; break;
00119 default: $this->icon = 'gfx/i/_icon_ftp.gif'; break;
00120 }
00121 $this->shortPath = substr($this->target,strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
00122 $this->title = $GLOBALS['FILEMOUNTS'][$key]['name'].': '.$this->shortPath;
00123
00124
00125
00126
00127 $this->doc = t3lib_div::makeInstance('template');
00128 $this->doc->docType = 'xhtml_trans';
00129 $this->doc->backPath = $BACK_PATH;
00130 $this->doc->JScode=$this->doc->wrapScriptTags('
00131 function backToList() {
00132 top.goToModule("file_list");
00133 }
00134 ');
00135 $this->doc->form='<form action="tce_file.php" method="post" name="editform">';
00136 }
00137
00143 function main() {
00144 global $BE_USER, $LANG, $TYPO3_CONF_VARS;
00145
00146 $this->content='';
00147 $this->content.=$this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.pagetitle'));
00148 $this->content.=$this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.pagetitle'));
00149 $this->content.=$this->doc->spacer(5);
00150 $this->content.=$this->doc->section('',$this->doc->getFileheader($this->title,$this->shortPath,$this->icon));
00151 $this->content.=$this->doc->divider(5);
00152
00153 $fI = pathinfo($this->target);
00154 $extList=$TYPO3_CONF_VARS['SYS']['textfile_ext'];
00155
00156 if ($extList && t3lib_div::inList($extList,strtolower($fI['extension']))) {
00157
00158 $fileContent = t3lib_div::getUrl($this->target);
00159
00160
00161 $hValue = 'file_edit.php?target='.rawurlencode($this->origTarget).'&returnUrl='.rawurlencode($this->returnUrl);
00162 $code = '';
00163 $code.='
00164 <div id="c-submit">
00165 <input type="hidden" name="redirect" value="'.htmlspecialchars($hValue).'" />
00166 <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.submit',1).'" />
00167 <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.saveAndClose',1).'" onclick="document.editform.redirect.value=\''.htmlspecialchars($this->returnUrl).'\';" />
00168 <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.cancel',1).'" onclick="backToList(); return false;" />
00169 </div>
00170 ';
00171
00172
00173 $code.='
00174 <div id="c-edit">
00175 <textarea rows="30" name="file[editfile][0][data]" wrap="off"'.$this->doc->formWidthText(48,'width:98%;height:80%','off').'>'.
00176 t3lib_div::formatForTextarea($fileContent).
00177 '</textarea>
00178 <input type="hidden" name="file[editfile][0][target]" value="'.$this->target.'" />
00179 </div>
00180 <br />';
00181
00182
00183 $code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_edit', $GLOBALS['BACK_PATH'],'|<br/>');
00184
00185
00186 if ($BE_USER->mayMakeShortcut()) {
00187 $this->MCONF['name']='xMOD_file_edit.php';
00188 $code.= '<br />'.$this->doc->makeShortcutIcon('target','',$this->MCONF['name'],1);
00189 }
00190 } else {
00191 $code.=sprintf($LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.coundNot'), $extList);
00192 }
00193
00194
00195 $this->content.= $this->doc->sectionEnd();
00196 $this->content.=$code;
00197
00198 $this->content.=$this->doc->endPage();
00199 }
00200
00206 function printContent() {
00207 echo $this->content;
00208 }
00209 }
00210
00211
00212 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/file_edit.php']) {
00213 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/file_edit.php']);
00214 }
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228 $SOBE = t3lib_div::makeInstance('SC_file_edit');
00229 $SOBE->init();
00230 $SOBE->main();
00231 $SOBE->printContent();
00232 ?>