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
00052 $BACK_PATH = '';
00053 require('init.php');
00054 require('template.php');
00055 require_once(PATH_t3lib.'class.t3lib_basicfilefunc.php');
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00074 class SC_file_rename {
00075
00076
00077 var $doc;
00078 var $basicff;
00079 var $icon;
00080 var $shortPath;
00081 var $title;
00082
00083
00084 var $target;
00085 var $returnUrl;
00086
00087
00088 var $content;
00089
00090
00096 function init() {
00097 global $LANG,$BACK_PATH,$TYPO3_CONF_VARS;
00098
00099
00100 $this->target = t3lib_div::_GP('target');
00101 $this->returnUrl = t3lib_div::_GP('returnUrl');
00102
00103
00104 $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
00105 $this->basicff->init($GLOBALS['FILEMOUNTS'],$TYPO3_CONF_VARS['BE']['fileExtensions']);
00106
00107
00108 if (@file_exists($this->target)) {
00109 $this->target=$this->basicff->cleanDirectoryName($this->target);
00110 } else {
00111 $this->target='';
00112 }
00113 $key=$this->basicff->checkPathAgainstMounts($this->target.'/');
00114 if (!$this->target || !$key) {
00115 t3lib_BEfunc::typo3PrintError ('Parameter Error','Target was not a directory!','');
00116 exit;
00117 }
00118
00119
00120 switch($GLOBALS['FILEMOUNTS'][$key]['type']) {
00121 case 'user': $this->icon = 'gfx/i/_icon_ftp_user.gif'; break;
00122 case 'group': $this->icon = 'gfx/i/_icon_ftp_group.gif'; break;
00123 default: $this->icon = 'gfx/i/_icon_ftp.gif'; break;
00124 }
00125
00126
00127 $this->shortPath = substr($this->target,strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
00128
00129
00130 $this->title = $GLOBALS['FILEMOUNTS'][$key]['name'].': '.$this->shortPath;
00131
00132
00133 $this->doc = t3lib_div::makeInstance('smallDoc');
00134 $this->doc->docType = 'xhtml_trans';
00135 $this->doc->backPath = $BACK_PATH;
00136 $this->doc->form='<form action="tce_file.php" method="post" name="editform">';
00137 $this->doc->JScode=$this->doc->wrapScriptTags('
00138 function backToList() {
00139 top.goToModule("file_list");
00140 }
00141 ');
00142 }
00143
00149 function main() {
00150 global $LANG;
00151
00152
00153 $this->content='';
00154 $this->content.=$this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_rename.php.pagetitle'));
00155 $this->content.=$this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_rename.php.pagetitle'));
00156 $this->content.=$this->doc->spacer(5);
00157 $this->content.=$this->doc->section('',$this->doc->getFileheader($this->title,$this->shortPath,$this->icon));
00158 $this->content.=$this->doc->divider(5);
00159
00160
00161
00162 $code='
00163
00164 <div id="c-rename">
00165 <input type="text" name="file[rename][0][data]" value="'.htmlspecialchars(basename($this->shortPath)).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' />
00166 <input type="hidden" name="file[rename][0][target]" value="'.htmlspecialchars($this->target).'" />
00167 </div>
00168 ';
00169
00170
00171 $code.='
00172 <div id="c-submit">
00173 <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_rename.php.submit',1).'" />
00174 <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.cancel',1).'" onclick="backToList(); return false;" />
00175 <input type="hidden" name="redirect" value="'.htmlspecialchars($this->returnUrl).'" />
00176 </div>
00177 ';
00178
00179
00180 $code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_rename', $GLOBALS['BACK_PATH'],'<br/>');
00181
00182
00183 $this->content.= $this->doc->section('',$code);
00184
00185
00186 $this->content.= $this->doc->endPage();
00187 }
00188
00194 function printContent() {
00195
00196 echo $this->content;
00197 }
00198 }
00199
00200
00201 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/file_rename.php']) {
00202 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/file_rename.php']);
00203 }
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217 $SOBE = t3lib_div::makeInstance('SC_file_rename');
00218 $SOBE->init();
00219 $SOBE->main();
00220 $SOBE->printContent();
00221 ?>