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