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
00052 $BACK_PATH = '';
00053 require('init.php');
00054 require('template.php');
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 class SC_file_rename {
00073
00074
00075
00076
00077
00078
00079
00080 var $doc;
00081
00082
00083
00084
00085
00086
00087 var $basicff;
00088 var $icon;
00089 var $shortPath;
00090 var $title;
00091
00092
00093 var $target;
00094 var $returnUrl;
00095
00096
00097 var $content;
00098
00099
00100
00101
00102
00103
00104
00105 function init() {
00106
00107 global $LANG,$BACK_PATH,$TYPO3_CONF_VARS;
00108
00109
00110 $this->target = t3lib_div::_GP('target');
00111 $this->returnUrl = t3lib_div::_GP('returnUrl');
00112
00113
00114 $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
00115 $this->basicff->init($GLOBALS['FILEMOUNTS'],$TYPO3_CONF_VARS['BE']['fileExtensions']);
00116
00117
00118 if (file_exists($this->target)) {
00119 $this->target=$this->basicff->cleanDirectoryName($this->target);
00120 } else {
00121 $this->target='';
00122 }
00123 $key=$this->basicff->checkPathAgainstMounts($this->target.'/');
00124 if (!$this->target || !$key) {
00125 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), '');
00126 exit;
00127 }
00128
00129
00130 switch($GLOBALS['FILEMOUNTS'][$key]['type']) {
00131 case 'user': $this->icon = 'gfx/i/_icon_ftp_user.gif'; break;
00132 case 'group': $this->icon = 'gfx/i/_icon_ftp_group.gif'; break;
00133 default: $this->icon = 'gfx/i/_icon_ftp.gif'; break;
00134 }
00135
00136 $this->icon = '<img'.t3lib_iconWorks::skinImg($this->backPath,$this->icon,'width="18" height="16"').' title="" alt="" />';
00137
00138
00139 $this->shortPath = substr($this->target,strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
00140
00141
00142 $this->title = $this->icon . htmlspecialchars($GLOBALS['FILEMOUNTS'][$key]['name']) . ': ' . $this->shortPath;
00143
00144
00145 $this->doc = t3lib_div::makeInstance('template');
00146 $this->doc->setModuleTemplate('templates/file_rename.html');
00147 $this->doc->backPath = $BACK_PATH;
00148 $this->doc->JScode=$this->doc->wrapScriptTags('
00149 function backToList() {
00150 top.goToModule("file_list");
00151 }
00152 ');
00153 }
00154
00155
00156
00157
00158
00159
00160 function main() {
00161
00162
00163 global $LANG;
00164
00165
00166 $this->content = $this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_rename.php.pagetitle'));
00167
00168 $pageContent = $this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_rename.php.pagetitle'));
00169 $pageContent .= $this->doc->spacer(5);
00170 $pageContent .= $this->doc->divider(5);
00171
00172
00173 $code = '<form action="tce_file.php" method="post" name="editform">';
00174
00175 $code .= '
00176
00177 <div id="c-rename">
00178 <input type="text" name="file[rename][0][data]" value="'.htmlspecialchars(basename($this->shortPath)).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' />
00179 <input type="hidden" name="file[rename][0][target]" value="'.htmlspecialchars($this->target).'" />
00180 </div>
00181 ';
00182
00183
00184 $code.='
00185 <div id="c-submit">
00186 <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_rename.php.submit',1).'" />
00187 <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.cancel',1).'" onclick="backToList(); return false;" />
00188 <input type="hidden" name="redirect" value="'.htmlspecialchars($this->returnUrl).'" />
00189 </div>
00190 ';
00191
00192 $code .= '</form>';
00193
00194
00195 $pageContent .= $code;
00196
00197 $docHeaderButtons = array();
00198 $docHeaderButtons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_rename', $GLOBALS['BACK_PATH']);
00199
00200
00201 $markerArray = array(
00202 'CSH' => $docHeaderButtons['csh'],
00203 'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']),
00204 'CONTENT' => $pageContent,
00205 'PATH' => $this->title,
00206 );
00207
00208 $this->content.= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
00209 $this->content.= $this->doc->endPage();
00210 $this->content = $this->doc->insertStylesAndJS($this->content);
00211 }
00212
00213
00214
00215
00216
00217
00218 function printContent() {
00219 echo $this->content;
00220 }
00221 }
00222
00223
00224 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/file_rename.php']) {
00225 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/file_rename.php']);
00226 }
00227
00228
00229
00230
00231 $SOBE = t3lib_div::makeInstance('SC_file_rename');
00232 $SOBE->init();
00233 $SOBE->main();
00234 $SOBE->printContent();
00235
00236 ?>