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_newfolder {
00075
00076
00077 var $folderNumber=10;
00078
00079
00080 var $doc;
00081 var $basicff;
00082 var $icon;
00083 var $shortPath;
00084 var $title;
00085
00086
00087 var $number;
00088 var $target;
00089 var $returnUrl;
00090
00091
00092 var $content;
00093
00094
00095
00101 function init() {
00102 global $LANG,$BACK_PATH,$TYPO3_CONF_VARS;
00103
00104
00105 $this->number = t3lib_div::_GP('number');
00106 $this->target = t3lib_div::_GP('target');
00107 $this->returnUrl = t3lib_div::_GP('returnUrl');
00108
00109
00110 $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
00111 $this->basicff->init($GLOBALS['FILEMOUNTS'],$TYPO3_CONF_VARS['BE']['fileExtensions']);
00112
00113
00114 $this->target=$this->basicff->is_directory($this->target);
00115 $key=$this->basicff->checkPathAgainstMounts($this->target.'/');
00116 if (!$this->target || !$key) {
00117 t3lib_BEfunc::typo3PrintError ('Parameter Error','Target was not a directory!','');
00118 exit;
00119 }
00120
00121
00122 switch($GLOBALS['FILEMOUNTS'][$key]['type']) {
00123 case 'user': $this->icon = 'gfx/i/_icon_ftp_user.gif'; break;
00124 case 'group': $this->icon = 'gfx/i/_icon_ftp_group.gif'; break;
00125 default: $this->icon = 'gfx/i/_icon_ftp.gif'; break;
00126 }
00127
00128
00129 $this->shortPath = substr($this->target,strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
00130
00131
00132 $this->title = $GLOBALS['FILEMOUNTS'][$key]['name'].': '.$this->shortPath;
00133
00134
00135 $this->doc = t3lib_div::makeInstance('smallDoc');
00136 $this->doc->docType = 'xhtml_trans';
00137 $this->doc->backPath = $BACK_PATH;
00138 $this->doc->form='<form action="tce_file.php" method="post" name="editform">';
00139 $this->doc->JScode=$this->doc->wrapScriptTags('
00140 var path = "'.$this->target.'";
00141
00142 function reload(a) {
00143 if (!changed || (changed && confirm('.$LANG->JScharCode($LANG->sL('LLL:EXT:lang/locallang_core.php:mess.redraw')).'))) {
00144 var params = "&target="+escape(path)+"&number="+a;
00145 document.location = "file_newfolder.php?"+params;
00146 }
00147 }
00148 function backToList() {
00149 top.goToModule("file_list");
00150 }
00151
00152 var changed = 0;
00153 ');
00154 }
00155
00161 function main() {
00162 global $LANG;
00163
00164
00165 $this->content='';
00166 $this->content.=$this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle'));
00167 $this->content.=$this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle'));
00168 $this->content.=$this->doc->spacer(5);
00169 $this->content.=$this->doc->section('',$this->doc->getFileheader($this->title,$this->shortPath,$this->icon));
00170 $this->content.=$this->doc->divider(5);
00171
00172
00173
00174 $this->number = t3lib_div::intInRange($this->number,1,10);
00175 $code='
00176 <div id="c-select">
00177 <select name="number" onchange="reload(this.options[this.selectedIndex].value);">';
00178 for ($a=1;$a<=$this->folderNumber;$a++) {
00179 $code.='
00180 <option value="'.$a.'"'.($this->number==$a?' selected="selected"':'').'>'.$a.' '.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.folders',1).'</option>';
00181 }
00182 $code.='
00183 </select>
00184 </div>
00185 ';
00186
00187
00188 $code.='
00189 <div id="c-createFolders">
00190 ';
00191 for ($a=0;$a<$this->number;$a++) {
00192 $code.='
00193 <input'.$this->doc->formWidth(20).' type="text" name="file[newfolder]['.$a.'][data]" onchange="changed=true;" />
00194 <input type="hidden" name="file[newfolder]['.$a.'][target]" value="'.htmlspecialchars($this->target).'" />
00195 ';
00196 }
00197 $code.='
00198 </div>
00199 ';
00200
00201
00202 $code.='
00203 <div id="c-submitFolders">
00204 <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.submit',1).'" />
00205 <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.cancel',1).'" onclick="backToList(); return false;" />
00206 <input type="hidden" name="redirect" value="'.htmlspecialchars($this->returnUrl).'" />
00207 </div>
00208 ';
00209
00210
00211 $code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_newfolder', $GLOBALS['BACK_PATH'],'<br/>');
00212
00213 $this->content.= $this->doc->section('',$code);
00214
00215
00216
00217
00218 $this->content.= $this->doc->spacer(10);
00219
00220
00221 $this->content.= $this->doc->sectionEnd();
00222 $this->content.= '</form><form action="tce_file.php" method="post" name="editform2">';
00223
00224
00225 $code='
00226 <div id="c-newFile">
00227 <p>['.htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext']).']</p>
00228 <input'.$this->doc->formWidth(20).' type="text" name="file[newfile][0][data]" onchange="changed=true;" />
00229 <input type="hidden" name="file[newfile][0][target]" value="'.htmlspecialchars($this->target).'" />
00230 </div>
00231 ';
00232
00233
00234 $code.='
00235 <div id="c-submitFiles">
00236 <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.newfile_submit',1).'" />
00237 <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.cancel',1).'" onclick="backToList(); return false;" />
00238 <input type="hidden" name="redirect" value="'.htmlspecialchars($this->returnUrl).'" />
00239 </div>
00240 ';
00241
00242
00243 $code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_newfile', $GLOBALS['BACK_PATH'],'<br/>');
00244
00245
00246 $this->content.= $this->doc->section($LANG->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.newfile'),$code);
00247
00248
00249 $this->content.= $this->doc->endPage();
00250 }
00251
00257 function printContent() {
00258
00259 echo $this->content;
00260 }
00261 }
00262
00263
00264 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/file_newfolder.php']) {
00265 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/file_newfolder.php']);
00266 }
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280 $SOBE = t3lib_div::makeInstance('SC_file_newfolder');
00281 $SOBE->init();
00282 $SOBE->main();
00283 $SOBE->printContent();
00284 ?>