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
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 $BACK_PATH = '';
00052 require('init.php');
00053 require('template.php');
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 class SC_file_edit {
00064 var $content;
00065
00066
00067
00068
00069
00070
00071 var $basicff;
00072 var $shortPath;
00073 var $title;
00074 var $icon;
00075
00076
00077
00078
00079
00080
00081 var $doc;
00082
00083
00084 var $origTarget;
00085 var $target;
00086 var $returnUrl;
00087
00088
00089
00090
00091
00092
00093
00094 function init() {
00095
00096 global $BACK_PATH,$TYPO3_CONF_VARS;
00097
00098
00099 $this->target = $this->origTarget = t3lib_div::_GP('target');
00100 $this->returnUrl = t3lib_div::_GP('returnUrl');
00101
00102
00103 $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
00104 $this->basicff->init($GLOBALS['FILEMOUNTS'],$TYPO3_CONF_VARS['BE']['fileExtensions']);
00105
00106
00107 if (file_exists($this->target)) {
00108 $this->target=$this->basicff->cleanDirectoryName($this->target);
00109 } else {
00110 $this->target='';
00111 }
00112 $key=$this->basicff->checkPathAgainstMounts($this->target.'/');
00113 if (!$this->target || !$key) {
00114 t3lib_BEfunc::typo3PrintError($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', true), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', true), '');
00115 exit;
00116 }
00117
00118 switch($GLOBALS['FILEMOUNTS'][$key]['type']) {
00119 case 'user': $this->icon = 'gfx/i/_icon_ftp_user.gif'; break;
00120 case 'group': $this->icon = 'gfx/i/_icon_ftp_group.gif'; break;
00121 default: $this->icon = 'gfx/i/_icon_ftp.gif'; break;
00122 }
00123
00124 $this->icon = '<img'.t3lib_iconWorks::skinImg($this->backPath,$this->icon,'width="18" height="16"').' title="" alt="" />';
00125
00126
00127 $this->shortPath = substr($this->target,strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
00128
00129
00130 $this->title = $this->icon.$GLOBALS['FILEMOUNTS'][$key]['name'].': '.$this->shortPath;
00131
00132
00133
00134
00135 $this->doc = t3lib_div::makeInstance('template');
00136 $this->doc->setModuleTemplate('templates/file_edit.html');
00137 $this->doc->backPath = $BACK_PATH;
00138 $this->doc->JScode=$this->doc->wrapScriptTags('
00139 function backToList() {
00140 top.goToModule("file_list");
00141 }
00142 ');
00143 $this->doc->form='<form action="tce_file.php" method="post" name="editform">';
00144 }
00145
00146
00147
00148
00149
00150
00151 function main() {
00152
00153 global $BE_USER, $LANG, $TYPO3_CONF_VARS;
00154 $docHeaderButtons = $this->getButtons();
00155
00156 $this->content = $this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.pagetitle'));
00157
00158 $pageContent = $this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.pagetitle'));
00159 $pageContent .= $this->doc->spacer(2);
00160
00161 $fI = pathinfo($this->target);
00162 $extList=$TYPO3_CONF_VARS['SYS']['textfile_ext'];
00163
00164 if ($extList && t3lib_div::inList($extList,strtolower($fI['extension']))) {
00165
00166 $fileContent = t3lib_div::getUrl($this->target);
00167
00168
00169 $hValue = 'file_edit.php?target='.rawurlencode($this->origTarget).'&returnUrl='.rawurlencode($this->returnUrl);
00170
00171
00172 $code.='
00173 <div id="c-edit">
00174 <textarea rows="30" name="file[editfile][0][data]" wrap="off"'.$this->doc->formWidthText(48,'width:98%;height:80%','off').' class="fixed-font enable-tab">'.
00175 t3lib_div::formatForTextarea($fileContent).
00176 '</textarea>
00177 <input type="hidden" name="file[editfile][0][target]" value="'.$this->target.'" />
00178 <input type="hidden" name="redirect" value="'.htmlspecialchars($hValue).'" />
00179 </div>
00180 <br />';
00181
00182
00183 if ($BE_USER->mayMakeShortcut()) {
00184 $this->MCONF['name']='xMOD_file_edit.php';
00185 $docHeaderButtons['shortcut'] = $this->doc->makeShortcutIcon('target','',$this->MCONF['name'],1);
00186 }
00187 } else {
00188 $code.=sprintf($LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.coundNot'), $extList);
00189 }
00190
00191
00192 $pageContent.= $this->doc->sectionEnd();
00193 $pageContent.=$code;
00194
00195
00196 $markerArray = array(
00197 'CSH' => $docHeaderButtons['csh'],
00198 'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']),
00199 'BUTTONS' => $docHeaderButtons,
00200 'PATH' => $this->title,
00201 'CONTENT' => $pageContent,
00202 );
00203
00204 $this->content.= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
00205 $this->content.= $this->doc->endPage();
00206 $this->content = $this->doc->insertStylesAndJS($this->content);
00207
00208
00209 }
00210
00211
00212
00213
00214
00215
00216 function printContent() {
00217 echo $this->content;
00218 }
00219
00220
00221
00222
00223
00224
00225 function getButtons() {
00226
00227 $buttons = array();
00228
00229
00230 $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_edit', $GLOBALS['BACK_PATH'], '', TRUE);
00231
00232
00233 $theIcon = t3lib_iconWorks::getSpriteIcon('actions-document-save');
00234 $buttons['SAVE'] = '<a href="#" onclick="document.editform.submit();" title="'.$GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.submit', TRUE)).'">' . $theIcon . '</a>';
00235
00236
00237 $theIcon = t3lib_iconWorks::getSpriteIcon('actions-document-save-close');
00238 $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.php:file_edit.php.saveAndClose', TRUE)).'">' . $theIcon . '</a>';
00239
00240
00241 $theIcon = t3lib_iconWorks::getSpriteIcon('actions-document-close');
00242 $buttons['CANCEL'] = '<a href="#" onclick="backToList(); return false;" title="' . $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.cancel', TRUE)) . '">' . $theIcon . '</a>';
00243
00244 return $buttons;
00245 }
00246 }
00247
00248
00249 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/file_edit.php']) {
00250 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/file_edit.php']);
00251 }
00252
00253
00254
00255
00256 $SOBE = t3lib_div::makeInstance('SC_file_edit');
00257 $SOBE->init();
00258 $SOBE->main();
00259 $SOBE->printContent();
00260
00261 ?>