Index: typo3/file_list.php =================================================================== --- typo3/file_list.php (Revision 5524) +++ typo3/file_list.php (Arbeitskopie) @@ -50,18 +50,13 @@ unset($MCONF); -require ('mod/file/list/conf.php'); -require ('init.php'); -require ('template.php'); +require('mod/file/list/conf.php'); +require('init.php'); +require('template.php'); $LANG->includeLLFile('EXT:lang/locallang_mod_file_list.xml'); $LANG->includeLLFile('EXT:lang/locallang_misc.xml'); -require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php'); -require_once (PATH_t3lib.'class.t3lib_extfilefunc.php'); -require_once (PATH_t3lib.'class.t3lib_recordlist.php'); -require_once (PATH_t3lib.'class.t3lib_clipboard.php'); -require_once (PATH_t3lib.'class.t3lib_parsehtml.php'); -require_once ('class.file_list.inc'); -$BE_USER->modAccess($MCONF,1); +require_once('class.file_list.inc'); +$BE_USER->modAccess($MCONF, 1); @@ -77,9 +72,9 @@ * @subpackage core */ class SC_file_list { - var $MCONF=array(); // Module configuration - var $MOD_MENU=array(); - var $MOD_SETTINGS=array(); + var $MCONF = array(); // Module configuration + var $MOD_MENU = array(); + var $MOD_SETTINGS = array(); // Internal: @@ -114,9 +109,7 @@ * * @return void */ - function init() { - global $TYPO3_CONF_VARS,$FILEMOUNTS; - + function init() { // Setting GPvars: $this->id = t3lib_div::_GP('id'); $this->pointer = t3lib_div::_GP('pointer'); @@ -130,7 +123,7 @@ // File operation object: $this->basicFF = t3lib_div::makeInstance('t3lib_basicFileFunctions'); - $this->basicFF->init($FILEMOUNTS,$TYPO3_CONF_VARS['BE']['fileExtensions']); + $this->basicFF->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']); // Configure the "menu" - which is used internally to save the values of sorting, displayThumbs etc. $this->menuConfig(); @@ -141,7 +134,7 @@ * * @return void */ - function menuConfig() { + function menuConfig() { // MENU-ITEMS: // If array, then it's a selector box menu // If empty string it's just a variable, that'll be saved. @@ -162,21 +155,20 @@ * * @return void */ - function main() { - global $BE_USER,$LANG,$BACK_PATH,$TYPO3_CONF_VARS,$FILEMOUNTS; + function main() { // Initialize the template object $this->doc = t3lib_div::makeInstance('template'); - $this->doc->backPath = $BACK_PATH; + $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('templates/file_list.html'); $this->doc->loadPrototype(); // Validating the input "id" (the path, directory!) and checking it against the mounts of the user. $this->id = $this->basicFF->is_directory($this->id); - $access = $this->id && $this->basicFF->checkPathAgainstMounts($this->id.'/'); + $access = ($this->id && $this->basicFF->checkPathAgainstMounts($this->id . '/')); // There there was access to this file path, continue, make the list - if ($access) { + if ($access) { // include the initialization for the flash uploader if ($GLOBALS['BE_USER']->uc['enableFlashUploader']) { @@ -240,37 +232,41 @@ } // Create filelisting object $this->filelist = t3lib_div::makeInstance('fileList'); - $this->filelist->backPath = $BACK_PATH; - $this->filelist->thumbs = $this->MOD_SETTINGS['displayThumbs']?1:$BE_USER->uc['thumbnailsByDefault']; + $this->filelist->backPath = $GLOBALS['BACK_PATH']; + $this->filelist->thumbs = ($this->MOD_SETTINGS['displayThumbs'] ? 1 : $BE_USER->uc['thumbnailsByDefault']); // Create clipboard object and initialize that $this->filelist->clipObj = t3lib_div::makeInstance('t3lib_clipboard'); - $this->filelist->clipObj->fileMode=1; + $this->filelist->clipObj->fileMode = 1; $this->filelist->clipObj->initializeClipboard(); $CB = t3lib_div::_GET('CB'); - if ($this->cmd=='setCB') $CB['el'] = $this->filelist->clipObj->cleanUpCBC(array_merge(t3lib_div::_POST('CBH'),t3lib_div::_POST('CBC')),'_FILE'); - if (!$this->MOD_SETTINGS['clipBoard']) $CB['setP']='normal'; + if ($this->cmd == 'setCB') { + $CB['el'] = $this->filelist->clipObj->cleanUpCBC(array_merge(t3lib_div::_POST('CBH'), t3lib_div::_POST('CBC')), '_FILE'); + } + if (!$this->MOD_SETTINGS['clipBoard']) { + $CB['setP'] = 'normal'; + } $this->filelist->clipObj->setCmd($CB); $this->filelist->clipObj->cleanCurrent(); - $this->filelist->clipObj->endClipboard(); // Saves + // Saves the clipboard + $this->filelist->clipObj->endClipboard(); // If the "cmd" was to delete files from the list (clipboard thing), do that: - if ($this->cmd=='delete') { - $items = $this->filelist->clipObj->cleanUpCBC(t3lib_div::_POST('CBC'),'_FILE',1); - if (count($items)) { + if ($this->cmd == 'delete') { + $items = $this->filelist->clipObj->cleanUpCBC(t3lib_div::_POST('CBC'), '_FILE', 1); + if (count($items)) { // Make command array: - $FILE=array(); - reset($items); - while(list(,$v)=each($items)) { - $FILE['delete'][]=array('data'=>$v); + $FILE = array(); + foreach ($items as $item) { + $FILE['delete'][] = array('data' => $item); } // Init file processing object for deleting and pass the cmd array. $fileProcessor = t3lib_div::makeInstance('t3lib_extFileFunctions'); - $fileProcessor->init($FILEMOUNTS, $TYPO3_CONF_VARS['BE']['fileExtensions']); + $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']); $fileProcessor->init_actionPerms($GLOBALS['BE_USER']->getFileoperationPermissions()); - $fileProcessor->dontCheckForUnique = $this->overwriteExistingFiles ? 1 : 0; + $fileProcessor->dontCheckForUnique = ($this->overwriteExistingFiles ? 1 : 0); $fileProcessor->start($FILE); $fileProcessor->processData(); @@ -278,15 +274,15 @@ } } - if (!isset($this->MOD_SETTINGS['sort'])) { + if (!isset($this->MOD_SETTINGS['sort'])) { // Set default sorting $this->MOD_SETTINGS['sort'] = 'file'; $this->MOD_SETTINGS['reverse'] = 0; } // Start up filelisting object, include settings. - $this->pointer = t3lib_div::intInRange($this->pointer,0,100000); - $this->filelist->start($this->id,$this->pointer,$this->MOD_SETTINGS['sort'],$this->MOD_SETTINGS['reverse'],$this->MOD_SETTINGS['clipBoard']); + $this->pointer = t3lib_div::intInRange($this->pointer, 0, 100000); + $this->filelist->start($this->id, $this->pointer, $this->MOD_SETTINGS['sort'], $this->MOD_SETTINGS['reverse'], $this->MOD_SETTINGS['clipBoard']); // Generate the list $this->filelist->generateList(); @@ -295,17 +291,17 @@ $this->filelist->writeBottom(); // Set top JavaScript: - $this->doc->JScode=$this->doc->wrapScriptTags(' + $this->doc->JScodeArray[] = ' + if (top.fsMod) top.fsMod.recentIds["file"] = unescape("' . rawurlencode($this->id) . '"); + function jumpToUrl(URL) { + window.location.href = URL; + } + '; - if (top.fsMod) top.fsMod.recentIds["file"] = unescape("'.rawurlencode($this->id).'"); - function jumpToUrl(URL) { // - window.location.href = URL; - } + // ... and add clipboard JavaScript functions + $this->doc->JScodeArray[] = $this->filelist->CBfunctions(); - '.$this->filelist->CBfunctions() // ... and add clipboard JavaScript functions - ); - - // This will return content necessary for the context sensitive clickmenus to work: bodytag events, JavaScript functions and DIV-layers. + // This will load the JS necessary for the context sensitive clickmenus $this->doc->getContextMenuCode(); // Setting up the buttons and markers for docheader @@ -317,17 +313,16 @@ $docHeaderButtons = array_merge($this->getButtons(), $buttons); // Build the
for the module - $this->content = $this->doc->startPage($LANG->getLL('files')); + $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('files')); // Create output - $pageContent=''; - $pageContent.= ''; + $pageContent = ''; + $pageContent .= ''; - - if ($this->filelist->HTMLcode) { // Making listing options: - + // Making listing options: + if ($this->filelist->HTMLcode) { $pageContent.='