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 $LANG->includeLLFile('EXT:lang/locallang_misc.xml');
00056 require_once(PATH_t3lib.'class.t3lib_basicfilefunc.php');
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00077 class SC_file_upload {
00078
00079
00080 var $uploadNumber=10;
00081
00082
00083 var $doc;
00084 var $basicff;
00085 var $icon;
00086 var $shortPath;
00087 var $title;
00088
00089
00090 var $number;
00091 var $target;
00092 var $returnUrl;
00093
00094
00095 var $content;
00096
00097
00103 function init() {
00104 global $LANG,$BACK_PATH,$TYPO3_CONF_VARS;
00105
00106
00107 $this->number = t3lib_div::_GP('number');
00108 $this->target = t3lib_div::_GP('target');
00109 $this->returnUrl = t3lib_div::_GP('returnUrl');
00110
00111
00112 $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
00113 $this->basicff->init($GLOBALS['FILEMOUNTS'],$TYPO3_CONF_VARS['BE']['fileExtensions']);
00114
00115
00116 $this->target=$this->basicff->is_directory($this->target);
00117 $key=$this->basicff->checkPathAgainstMounts($this->target.'/');
00118 if (!$this->target || !$key) {
00119 t3lib_BEfunc::typo3PrintError ('Parameter Error','Target was not a directory!','');
00120 exit;
00121 }
00122
00123
00124 switch($GLOBALS['FILEMOUNTS'][$key]['type']) {
00125 case 'user': $this->icon = 'gfx/i/_icon_ftp_user.gif'; break;
00126 case 'group': $this->icon = 'gfx/i/_icon_ftp_group.gif'; break;
00127 default: $this->icon = 'gfx/i/_icon_ftp.gif'; break;
00128 }
00129
00130
00131 $this->shortPath = substr($this->target,strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
00132
00133
00134 $this->title = $GLOBALS['FILEMOUNTS'][$key]['name'].': '.$this->shortPath;
00135
00136
00137 $this->doc = t3lib_div::makeInstance('smallDoc');
00138 $this->doc->docType = 'xhtml_trans';
00139 $this->doc->backPath = $BACK_PATH;
00140 $this->doc->form='<form action="tce_file.php" method="post" name="editform" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'">';
00141 $this->doc->JScode=$this->doc->wrapScriptTags('
00142 var path = "'.$this->target.'";
00143
00144 function reload(a) {
00145 if (!changed || (changed && confirm('.$LANG->JScharCode($LANG->sL('LLL:EXT:lang/locallang_core.php:mess.redraw')).'))) {
00146 var params = "&target="+escape(path)+"&number="+a;
00147 document.location = "file_upload.php?"+params;
00148 }
00149 }
00150 function backToList() {
00151 top.goToModule("file_list");
00152 }
00153 var changed = 0;
00154 ');
00155 }
00156
00162 function main() {
00163 global $LANG;
00164
00165
00166 $this->content='';
00167 $this->content.=$this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.pagetitle'));
00168 $this->content.=$this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.pagetitle'));
00169 $this->content.=$this->doc->spacer(5);
00170 $this->content.=$this->doc->section('',$this->doc->getFileheader($this->title,$this->shortPath,$this->icon));
00171 $this->content.=$this->doc->divider(5);
00172
00173
00174
00175 $this->number = t3lib_div::intInRange($this->number,1,10);
00176 $code='
00177 <div id="c-select">
00178 <select name="number" onchange="reload(this.options[this.selectedIndex].value);">';
00179 for ($a=1;$a<=$this->uploadNumber;$a++) {
00180 $code.='
00181 <option value="'.$a.'"'.($this->number==$a?' selected="selected"':'').'>'.$a.' '.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.files',1).'</option>';
00182 }
00183 $code.='
00184 </select>
00185 </div>
00186 ';
00187
00188
00189 $code.='
00190 <div id="c-override">
00191 <input type="checkbox" name="overwriteExistingFiles" value="1" /> '.$LANG->getLL('overwriteExistingFiles',1).'
00192 </div>
00193 ';
00194
00195
00196 $code.='
00197 <div id="c-upload">
00198 ';
00199 for ($a=0;$a<$this->number;$a++) {
00200
00201 $code.='
00202 <input type="file" name="upload_'.$a.'"'.$this->doc->formWidth(35).' size="50" onclick="changed=1;" />
00203 <input type="hidden" name="file[upload]['.$a.'][target]" value="'.htmlspecialchars($this->target).'" />
00204 <input type="hidden" name="file[upload]['.$a.'][data]" value="'.$a.'" /><br />
00205 ';
00206 }
00207 $code.='
00208 </div>
00209 ';
00210
00211
00212 $code.='
00213 <div id="c-submit">
00214 <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit',1).'" />
00215 <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.cancel',1).'" onclick="backToList(); return false;" />
00216 <input type="hidden" name="redirect" value="'.htmlspecialchars($this->returnUrl).'" />
00217 </div>
00218 ';
00219
00220
00221 $code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_upload', $GLOBALS['BACK_PATH'],'<br/>');
00222
00223
00224 $this->content.= $this->doc->section('',$code);
00225
00226
00227 $this->content.= $this->doc->endPage();
00228 }
00229
00235 function printContent() {
00236
00237 echo $this->content;
00238 }
00239 }
00240
00241
00242 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/file_upload.php']) {
00243 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/file_upload.php']);
00244 }
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258 $SOBE = t3lib_div::makeInstance('SC_file_upload');
00259 $SOBE->init();
00260 $SOBE->main();
00261 $SOBE->printContent();
00262 ?>