Exemplo n.º 1
0
 /**
  * Main function, detecting the current mode of the element browser and branching out to internal methods.
  *
  * @return	void
  */
 function main()
 {
     // Clear temporary DB mounts
     $tmpMount = t3lib_div::_GET('setTempDBmount');
     if (isset($tmpMount)) {
         $GLOBALS['BE_USER']->setAndSaveSessionData('pageTree_temporaryMountPoint', intval($tmpMount));
     }
     // Set temporary DB mounts
     $tempDBmount = intval($GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint'));
     if ($tempDBmount) {
         $altMountPoints = $tempDBmount;
     }
     if ($altMountPoints) {
         $GLOBALS['BE_USER']->groupData['webmounts'] = implode(',', array_unique(t3lib_div::intExplode(',', $altMountPoints)));
         $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
     }
     $this->content = '';
     // look for alternativ mountpoints
     switch ((string) $this->mode) {
         case 'rte':
         case 'db':
         case 'wizard':
             // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
             $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.altElementBrowserMountPoints'));
             if ($altMountPoints) {
                 $GLOBALS['BE_USER']->groupData['webmounts'] = implode(',', array_unique(t3lib_div::intExplode(',', $altMountPoints)));
                 $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
             }
         case 'file':
         case 'filedrag':
         case 'folder':
             // Setting additional read-only browsing file mounts
             $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
             if ($altMountPoints) {
                 $altMountPoints = t3lib_div::trimExplode(',', $altMountPoints);
                 foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
                     $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
                 }
                 $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts();
             }
             break;
     }
     // render type by user func
     $browserRendered = false;
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'] as $classRef) {
             $browserRenderObj = t3lib_div::getUserObj($classRef);
             if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) {
                 if ($browserRenderObj->isValid($this->mode, $this)) {
                     $this->content .= $browserRenderObj->render($this->mode, $this);
                     $browserRendered = true;
                     break;
                 }
             }
         }
     }
     // if type was not rendered use default rendering functions
     if (!$browserRendered) {
         $this->browser = t3lib_div::makeInstance('browse_links');
         $this->browser->init();
         $modData = $GLOBALS['BE_USER']->getModuleData('browse_links.php', 'ses');
         list($modData, $store) = $this->browser->processSessionData($modData);
         $GLOBALS['BE_USER']->pushModuleData('browse_links.php', $modData);
         // Output the correct content according to $this->mode
         switch ((string) $this->mode) {
             case 'rte':
                 $this->content = $this->browser->main_rte();
                 break;
             case 'db':
                 $this->content = $this->browser->main_db();
                 break;
             case 'file':
             case 'filedrag':
                 $this->content = $this->browser->main_file();
                 break;
             case 'folder':
                 $this->content = $this->browser->main_folder();
                 break;
             case 'wizard':
                 $this->content = $this->browser->main_rte(1);
                 break;
         }
     }
 }
 /**
  * Makes a form for creating new folders in the filemount the user is browsing.
  * The folder creation request is sent to the tce_file.php script in the core which will handle the creation.
  *
  * @param	string		Absolute filepath on server in which to create the new folder.
  * @return	string		HTML for the create folder form.
  */
 function createFolder($path)
 {
     if ($path != '/' && @is_dir($path)) {
         return parent::createFolder($path);
     }
     return '';
 }