/** * Constructor for initializing the class * * @return void * @todo Define visibility */ public function init() { // Initialize GPvars: $this->target = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('target'); $this->returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnUrl')); if (!$this->returnUrl) { $this->returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('file_list') . '&id=' . rawurlencode($this->target); } // Create the folder object if ($this->target) { $this->folderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->target); } // Cleaning and checking target directory if (!$this->folderObject) { $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', TRUE); $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', TRUE); throw new \RuntimeException($title . ': ' . $message, 1294586843); } // Setting the title and the icon $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-filetree-root'); $this->title = $icon . htmlspecialchars($this->folderObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->folderObject->getIdentifier()); // Setting template object $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->setModuleTemplate('templates/file_upload.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->form = '<form action="tce_file.php" method="post" name="editform" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">'; }
/** * Constructor function for class * * @return void * @todo Define visibility */ public function init() { // Initialize GPvars: $this->number = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('number'); $this->target = $combinedIdentifier = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('target'); $this->returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnUrl')); // create the folder object if ($combinedIdentifier) { $this->folderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($combinedIdentifier); } // Cleaning and checking target directory if (!$this->folderObject) { $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', TRUE); $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', TRUE); throw new \RuntimeException($title . ': ' . $message, 1294586843); } // Setting the title and the icon $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-filetree-root'); $this->title = $icon . htmlspecialchars($this->folderObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->folderObject->getIdentifier()); // Setting template object $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->setModuleTemplate('templates/file_newfolder.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->JScode = $this->doc->wrapScriptTags(' var path = "' . $this->target . '"; function reload(a) { // if (!changed || (changed && confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.redraw')) . '))) { var params = "&target="+encodeURIComponent(path)+"&number="+a+"&returnUrl=' . rawurlencode($this->returnUrl) . '"; window.location.href = "file_newfolder.php?"+params; } } function backToList() { // top.goToModule("file_list"); } var changed = 0; '); }
/** * Constructor function for class * * @return void * @todo Define visibility */ public function init() { // Initialize GPvars: $this->target = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('target'); $this->returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnUrl')); // Cleaning and checking target if ($this->target) { $this->fileOrFolderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->target); } if (!$this->fileOrFolderObject) { $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', TRUE); $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', TRUE); throw new \RuntimeException($title . ': ' . $message, 1294586844); } // If a folder should be renamed, AND the returnURL should go to the old directory name, the redirect is forced // so the redirect will NOT end in a error message // this case only happens if you select the folder itself in the foldertree and then use the clickmenu to // rename the folder if ($this->fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) { $parsedUrl = parse_url($this->returnUrl); $queryParts = \TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array(urldecode($parsedUrl['query'])); if ($queryParts['id'] === $this->fileOrFolderObject->getCombinedIdentifier()) { $this->returnUrl = str_replace(urlencode($queryParts['id']), urlencode($this->fileOrFolderObject->getStorage()->getRootLevelFolder()->getCombinedIdentifier()), $this->returnUrl); } } // Setting icon and title $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-filetree-root'); $this->title = $icon . htmlspecialchars($this->fileOrFolderObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->fileOrFolderObject->getIdentifier()); // Setting template object $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->setModuleTemplate('templates/file_rename.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->JScode = $this->doc->wrapScriptTags(' function backToList() { // top.goToModule("file_list"); } '); }