/**
  * Constructor, initializing internal variables.
  *
  * @return void
  * @todo Define visibility
  */
 public function init()
 {
     // Setting class files to include:
     if (is_array($GLOBALS['TBE_MODULES_EXT']['xMOD_db_new_content_el']['addElClasses'])) {
         $this->include_once = array_merge($this->include_once, $GLOBALS['TBE_MODULES_EXT']['xMOD_db_new_content_el']['addElClasses']);
     }
     // Setting internal vars:
     $this->id = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'));
     $this->sys_language = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('sys_language_uid'));
     $this->R_URI = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnUrl'));
     $this->colPos = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('colPos');
     $this->uid_pid = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('uid_pid'));
     $this->MCONF['name'] = 'xMOD_db_new_content_el';
     $this->modTSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($this->id, 'mod.wizards.newContentElement');
     $config = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($this->id);
     $this->config = $config['mod.']['wizards.']['newContentElement.'];
     // Starting the document template object:
     $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
     $this->doc->backPath = $GLOBALS['BACK_PATH'];
     $this->doc->setModuleTemplate('templates/db_new_content_el.html');
     $this->doc->JScode = '';
     $this->doc->form = '<form action="" name="editForm"><input type="hidden" name="defValues" value="" />';
     // Setting up the context sensitive menu:
     $this->doc->getContextMenuCode();
     // Getting the current page and receiving access information (used in main())
     $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
     $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $perms_clause);
     $this->access = is_array($this->pageinfo) ? 1 : 0;
 }
示例#2
0
 /**
  * Main function
  * Will issue a location-header, redirecting either BACK or to a new FormEngine instance...
  *
  * @return void
  */
 public function main()
 {
     // Get this record
     $origRow = BackendUtility::getRecord($this->P['table'], $this->P['uid']);
     // Get TSconfig for it.
     $TSconfig = BackendUtility::getTCEFORM_TSconfig($this->table, is_array($origRow) ? $origRow : array('pid' => $this->P['pid']));
     // Set [params][pid]
     if (substr($this->P['params']['pid'], 0, 3) === '###' && substr($this->P['params']['pid'], -3) === '###') {
         $keyword = substr($this->P['params']['pid'], 3, -3);
         if (strpos($keyword, 'PAGE_TSCONFIG_') === 0) {
             $this->pid = (int) $TSconfig[$this->P['field']][$keyword];
         } else {
             $this->pid = (int) $TSconfig['_' . $keyword];
         }
     } else {
         $this->pid = (int) $this->P['params']['pid'];
     }
     // Make redirect:
     // If pid is blank OR if id is set, then return...
     if ((string) $this->id !== '') {
         $redirectUrl = GeneralUtility::sanitizeLocalUrl($this->P['returnUrl']);
     } else {
         // Otherwise, show the list:
         $urlParameters = array();
         $urlParameters['id'] = $this->pid;
         $urlParameters['table'] = $this->P['params']['table'];
         $urlParameters['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI');
         $redirectUrl = BackendUtility::getModuleUrl('web_list', $urlParameters);
     }
     \TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
 }
 /**
  * Initialize
  *
  * @return void
  */
 protected function init()
 {
     // Initialize GPvars:
     $this->target = GeneralUtility::_GP('target');
     $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
     if (!$this->returnUrl) {
         $this->returnUrl = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . 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);
     }
     if ($this->folderObject->getStorage()->getUid() === 0) {
         throw new \TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException('You are not allowed to access folders outside your storages', 1375889834);
     }
     // Cleaning and checking target directory
     if (!$this->folderObject) {
         $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', TRUE);
         $message = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf: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 = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
     $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/file_upload.html');
     $this->doc->backPath = $GLOBALS['BACK_PATH'];
     $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_file')) . '" method="post" name="editform" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">';
 }
 /**
  * Initialize
  *
  * @throws InsufficientFolderAccessPermissionsException
  */
 protected function init()
 {
     // Initialize GPvars:
     $this->target = GeneralUtility::_GP('target');
     $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
     if (!$this->returnUrl) {
         $this->returnUrl = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . BackendUtility::getModuleUrl('file_list') . '&id=' . rawurlencode($this->target);
     }
     // Create the folder object
     if ($this->target) {
         $this->folderObject = ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->target);
     }
     if ($this->folderObject->getStorage()->getUid() === 0) {
         throw new InsufficientFolderAccessPermissionsException('You are not allowed to access folders outside your storages', 1375889834);
     }
     // Cleaning and checking target directory
     if (!$this->folderObject) {
         $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', true);
         $message = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', true);
         throw new \RuntimeException($title . ': ' . $message, 1294586843);
     }
     // Setting up the context sensitive menu
     $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
     // building pathInfo for metaInformation
     $pathInfo = ['combined_identifier' => $this->folderObject->getCombinedIdentifier()];
     $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($pathInfo);
 }
示例#5
0
    /**
     * Initialize script class
     *
     * @return void
     * @throws \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException
     */
    protected function init()
    {
        // Setting target, which must be a file reference to a file within the mounts.
        $this->target = $this->origTarget = $fileIdentifier = GeneralUtility::_GP('target');
        $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
        // create the file object
        if ($fileIdentifier) {
            $this->fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($fileIdentifier);
        }
        // Cleaning and checking target directory
        if (!$this->fileObject) {
            $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', TRUE);
            $message = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', TRUE);
            throw new \RuntimeException($title . ': ' . $message, 1294586841);
        }
        if ($this->fileObject->getStorage()->getUid() === 0) {
            throw new \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException('You are not allowed to access files outside your storages', 1375889832);
        }
        // Setting the title and the icon
        $icon = IconUtility::getSpriteIcon('apps-filetree-root');
        $this->title = $icon . htmlspecialchars($this->fileObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->fileObject->getIdentifier());
        // Setting template object
        $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
        $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/file_edit.html');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->JScode = $this->doc->wrapScriptTags('
			function backToList() {	//
				top.goToModule("file_list");
			}
		');
        $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_file')) . '" method="post" name="editform">';
    }
    /**
     * Initialize script class
     *
     * @return 	void
     * @todo Define visibility
     */
    public function init()
    {
        // Setting target, which must be a file reference to a file within the mounts.
        $this->target = $this->origTarget = $fileIdentifier = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('target');
        $this->returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnUrl'));
        // create the file object
        if ($fileIdentifier) {
            $this->fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($fileIdentifier);
        }
        // Cleaning and checking target directory
        if (!$this->fileObject) {
            $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, 1294586841);
        }
        // Setting the title and the icon
        $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-filetree-root');
        $this->title = $icon . htmlspecialchars($this->fileObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->fileObject->getIdentifier());
        // ***************************
        // Setting template object
        // ***************************
        $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
        $this->doc->setModuleTemplate('templates/file_edit.html');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->JScode = $this->doc->wrapScriptTags('
			function backToList() {	//
				top.goToModule("file_list");
			}
		');
        $this->doc->form = '<form action="tce_file.php" method="post" name="editform">';
    }
 /**
  * Initializing the module
  *
  * @return void
  */
 public function init()
 {
     $this->getLanguageService()->includeLLFile('EXT:lang/locallang_mod_web_list.xml');
     // Setting GPvars:
     $this->id = (int) GeneralUtility::_GP('id');
     if (!$this->id) {
         Tx_Commerce_Utility_FolderUtility::initFolders();
         $this->id = current(array_unique(Tx_Commerce_Domain_Repository_FolderRepository::initFolders('Products', 'Commerce', 0, 'Commerce')));
     }
     // Initialize the listing object, dblist, for rendering the list:
     $this->pointer = max(min(GeneralUtility::_GP('pointer'), 100000), 0);
     $this->imagemode = GeneralUtility::_GP('imagemode');
     $this->table = GeneralUtility::_GP('table');
     $this->search_field = GeneralUtility::_GP('search_field');
     $this->search_levels = GeneralUtility::_GP('search_levels');
     $this->showLimit = (int) GeneralUtility::_GP('showLimit');
     $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
     $this->clear_cache = (bool) GeneralUtility::_GP('clear_cache');
     $this->cmd = GeneralUtility::_GP('cmd');
     $this->cmd_table = GeneralUtility::_GP('cmd_table');
     // Setting GPvars:
     $controlParams = GeneralUtility::_GP('control');
     if ($controlParams) {
         $controlArray = current($controlParams);
         $this->categoryUid = (int) $controlArray['uid'];
     }
     // Module name;
     $this->MCONF = $GLOBALS['MCONF'];
     // Page select clause:
     $this->perms_clause = Tx_Commerce_Utility_BackendUtility::getCategoryPermsClause(1);
     $this->initPage();
     $this->clearCache();
     // Set up menus:
     $this->menuConfig();
 }
 /**
  * Initialization
  *
  * @return void
  */
 public function init()
 {
     $this->getLanguageService()->includeLLFile('EXT:commerce/Resources/Private/Language/locallang_mod_orders.xml');
     $this->getLanguageService()->includeLLFile('EXT:lang/locallang_mod_web_list.php');
     // Setting GPvars:
     $this->id = (int) GeneralUtility::_GP('id');
     // Find the right pid for the Ordersfolder
     $this->orderPid = current(array_unique(Tx_Commerce_Domain_Repository_FolderRepository::initFolders('Orders', 'Commerce', 0, 'Commerce')));
     if ($this->id == $this->orderPid) {
         $this->id = 0;
     }
     // Initialize the listing object, dblist, for rendering the list:
     $this->pointer = max(min(GeneralUtility::_GP('pointer'), 100000), 0);
     $this->imagemode = GeneralUtility::_GP('imagemode');
     $this->table = GeneralUtility::_GP('table');
     $this->search_field = GeneralUtility::_GP('search_field');
     $this->search_levels = GeneralUtility::_GP('search_levels');
     $this->showLimit = (int) GeneralUtility::_GP('showLimit');
     $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
     $this->clear_cache = (bool) GeneralUtility::_GP('clear_cache');
     $this->cmd = GeneralUtility::_GP('cmd');
     $this->cmd_table = GeneralUtility::_GP('cmd_table');
     // Module name;
     $this->MCONF = $GLOBALS['MCONF'];
     // Page select clause:
     $this->perms_clause = $this->getBackendUser()->getPagePermsClause(1);
     $this->initPage();
     $this->clearCache();
     // Set up menus:
     $this->menuConfig();
 }
 /**
  * Process add media request
  *
  * @param ServerRequestInterface $request
  * @param ResponseInterface $response
  * @return ResponseInterface
  */
 public function mainAction(ServerRequestInterface $request, ResponseInterface $response)
 {
     $files = $request->getParsedBody()['file'];
     $newMedia = [];
     if (isset($files['newMedia'])) {
         $newMedia = (array) $files['newMedia'];
     }
     foreach ($newMedia as $media) {
         if (!empty($media['url']) && !empty($media['target'])) {
             $allowed = !empty($media['allowed']) ? GeneralUtility::trimExplode(',', $media['allowed']) : [];
             $file = $this->addMediaFromUrl($media['url'], $media['target'], $allowed);
             if ($file !== null) {
                 $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $file->getName(), $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:online_media.new_media.added'), FlashMessage::OK, true);
             } else {
                 $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:online_media.error.invalid_url'), $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:online_media.error.new_media.failed'), FlashMessage::ERROR, true);
             }
             $this->addFlashMessage($flashMessage);
         }
     }
     $redirect = isset($request->getParsedBody()['redirect']) ? $request->getParsedBody()['redirect'] : $request->getQueryParams()['redirect'];
     $redirect = GeneralUtility::sanitizeLocalUrl($redirect);
     if ($redirect) {
         $response = $response->withHeader('Location', GeneralUtility::locationHeaderUrl($redirect))->withStatus(303);
     }
     return $response;
 }
 /**
  * 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'] . '">';
 }
示例#11
0
 /**
  * Main function
  * Will issue a location-header, redirecting either BACK or to a new alt_doc.php instance...
  *
  * @return void
  * @todo Define visibility
  */
 public function main()
 {
     // Get this record
     $origRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($this->P['table'], $this->P['uid']);
     // Get TSconfig for it.
     $TSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getTCEFORM_TSconfig($this->table, is_array($origRow) ? $origRow : array('pid' => $this->P['pid']));
     // Set [params][pid]
     if (substr($this->P['params']['pid'], 0, 3) == '###' && substr($this->P['params']['pid'], -3) == '###') {
         $this->pid = intval($TSconfig['_' . substr($this->P['params']['pid'], 3, -3)]);
     } else {
         $this->pid = intval($this->P['params']['pid']);
     }
     // Make redirect:
     // If pid is blank OR if id is set, then return...
     if (!strcmp($this->pid, '') || strcmp($this->id, '')) {
         $redirectUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl($this->P['returnUrl']);
     } else {
         // Otherwise, show the list:
         $urlParameters = array();
         $urlParameters['id'] = $this->pid;
         $urlParameters['table'] = $this->P['params']['table'];
         $urlParameters['returnUrl'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI');
         $redirectUrl = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_list', $urlParameters);
     }
     \TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
 }
示例#12
0
 /**
  * Initialize the login box. Will also react on a &L=OUT flag and exit.
  */
 public function __construct()
 {
     $this->validateAndSortLoginProviders();
     // We need a PHP session session for most login levels
     session_start();
     $this->redirectUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('redirect_url'));
     $this->loginProviderIdentifier = $this->detectLoginProvider();
     $this->loginRefresh = (bool) GeneralUtility::_GP('loginRefresh');
     // Value of "Login" button. If set, the login button was pressed.
     $this->submitValue = GeneralUtility::_GP('commandLI');
     // Try to get the preferred browser language
     $preferredBrowserLanguage = $this->getLanguageService()->csConvObj->getPreferredClientLanguage(GeneralUtility::getIndpEnv('HTTP_ACCEPT_LANGUAGE'));
     // If we found a $preferredBrowserLanguage and it is not the default language and no be_user is logged in
     // initialize $this->getLanguageService() again with $preferredBrowserLanguage
     if ($preferredBrowserLanguage !== 'default' && empty($this->getBackendUserAuthentication()->user['uid'])) {
         $this->getLanguageService()->init($preferredBrowserLanguage);
     }
     $this->getLanguageService()->includeLLFile('EXT:lang/locallang_login.xlf');
     // Setting the redirect URL to "index.php?M=main" if no alternative input is given
     $this->redirectToURL = $this->redirectUrl ?: BackendUtility::getModuleUrl('main');
     // If "L" is "OUT", then any logged in is logged out. If redirect_url is given, we redirect to it
     if (GeneralUtility::_GP('L') === 'OUT' && is_object($this->getBackendUserAuthentication())) {
         $this->getBackendUserAuthentication()->logoff();
         HttpUtility::redirect($this->redirectUrl);
     }
     $this->view = $this->getFluidTemplateObject();
 }
示例#13
0
 /**
  * Performs the logout processing
  *
  * @return void
  */
 public function logout()
 {
     // Logout written to log
     $GLOBALS['BE_USER']->writelog(255, 2, 0, 1, 'User %s logged out from TYPO3 Backend', array($GLOBALS['BE_USER']->user['username']));
     \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get()->removeSessionTokenFromRegistry();
     $GLOBALS['BE_USER']->logoff();
     $redirect = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('redirect'));
     $redirectUrl = $redirect ? $redirect : 'index.php';
     \TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
 }
示例#14
0
 /**
  * Registering incoming data
  *
  * @return void
  */
 public function init()
 {
     // Set the GPvars from outside
     $this->file = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('file');
     $this->CB = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('CB');
     $this->overwriteExistingFiles = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('overwriteExistingFiles');
     $this->vC = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('vC');
     $this->redirect = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('redirect'));
     $this->initClipboard();
 }
示例#15
0
 /**
  * Registering incoming data
  *
  * @return void
  */
 protected function init()
 {
     // Set the GPvars from outside
     $this->file = GeneralUtility::_GP('file');
     $this->CB = GeneralUtility::_GP('CB');
     $this->overwriteExistingFiles = GeneralUtility::_GP('overwriteExistingFiles');
     $this->vC = GeneralUtility::_GP('vC');
     $this->redirect = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('redirect'));
     $this->initClipboard();
     $this->fileProcessor = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\File\\ExtendedFileUtility');
 }
示例#16
0
 /**
  * Injects the request object for the current request or subrequest
  * As this controller goes only through the main() method, it is rather simple for now
  * This will be split up in an abstract controller once proper routing/dispatcher is in place.
  *
  * @param ServerRequestInterface $request the current request
  * @param ResponseInterface $response
  * @return ResponseInterface the response with the content
  */
 public function logoutAction(ServerRequestInterface $request, ResponseInterface $response)
 {
     $this->logout();
     $redirectUrl = isset($request->getParsedBody()['redirect']) ? $request->getParsedBody()['redirect'] : $request->getQueryParams()['redirect'];
     $redirectUrl = GeneralUtility::sanitizeLocalUrl($redirectUrl);
     if (empty($redirectUrl)) {
         /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
         $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
         $redirectUrl = (string) $uriBuilder->buildUriFromRoute('login', array(), $uriBuilder::ABSOLUTE_URL);
     }
     return $response->withStatus(303)->withHeader('Location', GeneralUtility::locationHeaderUrl($redirectUrl));
 }
示例#17
0
 /**
  * Performs the logout processing
  *
  * @return void
  */
 public function logout()
 {
     // Logout written to log
     $this->getBackendUser()->writelog(255, 2, 0, 1, 'User %s logged out from TYPO3 Backend', array($this->getBackendUser()->user['username']));
     /** @var \TYPO3\CMS\Core\FormProtection\BackendFormProtection $backendFormProtection */
     $backendFormProtection = FormProtectionFactory::get();
     $backendFormProtection->removeSessionTokenFromRegistry();
     $this->getBackendUser()->logoff();
     $redirect = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('redirect'));
     $redirectUrl = $redirect ? $redirect : 'index.php';
     HttpUtility::redirect($redirectUrl);
 }
    /**
     * Initialize
     *
     * @return void
     */
    protected function init()
    {
        // Initialize GPvars:
        $this->target = GeneralUtility::_GP('target');
        $this->returnUrl = GeneralUtility::sanitizeLocalUrl(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.xlf:paramError', TRUE);
            $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', TRUE);
            throw new \RuntimeException($title . ': ' . $message, 1294586844);
        }
        if ($this->fileOrFolderObject->getStorage()->getUid() === 0) {
            throw new \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException('You are not allowed to access files outside your storages', 1375889840);
        }
        // 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 = 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 = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
        $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/file_rename.html');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->JScode = $this->doc->wrapScriptTags('
			function backToList() {	//
				top.goToModule("file_list");
			}
		');
    }
 /**
  * Constructor, initializing internal variables.
  *
  * @return void
  * @todo Define visibility
  */
 public function init()
 {
     // Setting internal vars:
     $this->sys_language = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('sys_language'));
     $this->page_id = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('uid'));
     $this->table = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('table');
     $this->R_URI = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnUrl'));
     $this->input_moveUid = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('moveUid');
     $this->moveUid = $this->input_moveUid ? $this->input_moveUid : $this->page_id;
     $this->makeCopy = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('makeCopy');
     // Select-pages where clause for read-access:
     $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
     // Starting the document template object:
     $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
     $this->doc->backPath = $GLOBALS['BACK_PATH'];
     $this->doc->setModuleTemplate('templates/move_el.html');
     $this->doc->JScode = '';
     // Starting document content (header):
     $this->content = '';
     $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('movingElement'));
 }
    /**
     * 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;
		');
    }
示例#21
0
 /**
  * Initialize
  *
  * @throws \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException
  */
 protected function init()
 {
     // Initialize GPvars:
     $this->target = GeneralUtility::_GP('target');
     $this->returnUrl = GeneralUtility::sanitizeLocalUrl(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 = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', true);
         $message = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', true);
         throw new \RuntimeException($title . ': ' . $message, 1294586844);
     }
     if ($this->fileOrFolderObject->getStorage()->getUid() === 0) {
         throw new \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException('You are not allowed to access files outside your storages', 1375889840);
     }
     // 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 an 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 = 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);
         }
     }
     // building pathInfo for metaInformation
     $pathInfo = ['combined_identifier' => $this->fileOrFolderObject->getCombinedIdentifier()];
     $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($pathInfo);
     // Setting up the context sensitive menu
     $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
     // Add javaScript
     $this->moduleTemplate->addJavaScriptCode('RenameFileInlineJavaScript', 'function backToList() {top.goToModule("file_FilelistList");}');
 }
 /**
  * @throws InsufficientFolderAccessPermissionsException
  * @throws \RuntimeException
  */
 protected function init()
 {
     // Initialize GPvars:
     $this->number = GeneralUtility::_GP('number');
     $this->target = $combinedIdentifier = GeneralUtility::_GP('target');
     $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
     // create the folder object
     if ($combinedIdentifier) {
         $this->folderObject = ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($combinedIdentifier);
     }
     // Cleaning and checking target directory
     if (!$this->folderObject) {
         $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', true);
         $message = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', true);
         throw new \RuntimeException($title . ': ' . $message, 1294586845);
     }
     if ($this->folderObject->getStorage()->getUid() === 0) {
         throw new InsufficientFolderAccessPermissionsException('You are not allowed to access folders outside your storages', 1375889838);
     }
     $pathInfo = ['combined_identifier' => $this->folderObject->getCombinedIdentifier()];
     $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($pathInfo);
     $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
     $this->moduleTemplate->addJavaScriptCode('CreateFolderInlineJavaScript', 'var path = "' . $this->target . '";
         function reload(a) {
         if (!changed || (changed && confirm(' . GeneralUtility::quoteJSvalue($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.redraw')) . '))) {
                 var params = "&target="+encodeURIComponent(path)+"&number="+a+"&returnUrl=' . rawurlencode($this->returnUrl) . '";
                 window.location.href = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('file_newfolder')) . '+params;
             }
         }
         function backToList() {
             top.goToModule("file_FilelistList");
         }
         var changed = 0;');
 }
 /**
  * Constructor, initializing internal variables.
  *
  * @return void
  */
 public function init()
 {
     // Setting internal vars:
     $this->sys_language = (int) GeneralUtility::_GP('sys_language');
     $this->page_id = (int) GeneralUtility::_GP('uid');
     $this->table = GeneralUtility::_GP('table');
     $this->R_URI = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
     $this->input_moveUid = GeneralUtility::_GP('moveUid');
     $this->moveUid = $this->input_moveUid ? $this->input_moveUid : $this->page_id;
     $this->makeCopy = GeneralUtility::_GP('makeCopy');
     // Select-pages where clause for read-access:
     $this->perms_clause = $this->getBackendUser()->getPagePermsClause(1);
     $this->content = '<h1>' . $this->getLanguageService()->getLL('movingElement') . '</h1>';
 }
 /**
  * @test
  * @dataProvider sanitizeLocalUrlInvalidDataProvider
  */
 public function sanitizeLocalUrlDeniesEncodedInvalidUrls($url)
 {
     $this->assertEquals('', Utility\GeneralUtility::sanitizeLocalUrl(rawurlencode($url)));
 }
 /**
  * Constructor, initializing internal variables.
  *
  * @return void
  */
 public function init()
 {
     $lang = $this->getLanguageService();
     $lang->includeLLFile('EXT:lang/locallang_misc.xlf');
     $LOCAL_LANG_orig = $GLOBALS['LOCAL_LANG'];
     $lang->includeLLFile('EXT:backend/Resources/Private/Language/locallang_db_new_content_el.xlf');
     ArrayUtility::mergeRecursiveWithOverrule($LOCAL_LANG_orig, $GLOBALS['LOCAL_LANG']);
     $GLOBALS['LOCAL_LANG'] = $LOCAL_LANG_orig;
     // Setting internal vars:
     $this->id = (int) GeneralUtility::_GP('id');
     $this->sys_language = (int) GeneralUtility::_GP('sys_language_uid');
     $this->R_URI = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
     $this->colPos = GeneralUtility::_GP('colPos') === null ? null : (int) GeneralUtility::_GP('colPos');
     $this->uid_pid = (int) GeneralUtility::_GP('uid_pid');
     $this->MCONF['name'] = 'xMOD_db_new_content_el';
     $this->modTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.wizards.newContentElement');
     $config = BackendUtility::getPagesTSconfig($this->id);
     $this->config = $config['mod.']['wizards.']['newContentElement.'];
     // Starting the document template object:
     // We keep this here in case somebody relies on it in a hook or alike
     $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
     // Setting up the context sensitive menu:
     $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
     // Getting the current page and receiving access information (used in main())
     $perms_clause = $this->getBackendUser()->getPagePermsClause(1);
     $this->pageInfo = BackendUtility::readPageAccess($this->id, $perms_clause);
     $this->access = is_array($this->pageInfo) ? 1 : 0;
 }
 /**
  * Will get and return the configuration code string
  * Will also save (and possibly redirect/exit) the content if a save button has been pressed
  *
  * @param array $row Current parent record row
  * @return array Table config code in an array
  * @internal
  */
 public function getConfigCode($row)
 {
     // Get delimiter settings
     $flexForm = GeneralUtility::xml2array($row['pi_flexform']);
     if (is_array($flexForm)) {
         $this->tableParsing_quote = $flexForm['data']['s_parsing']['lDEF']['tableparsing_quote']['vDEF'] ? chr((int) $flexForm['data']['s_parsing']['lDEF']['tableparsing_quote']['vDEF']) : '';
         $this->tableParsing_delimiter = $flexForm['data']['s_parsing']['lDEF']['tableparsing_delimiter']['vDEF'] ? chr((int) $flexForm['data']['s_parsing']['lDEF']['tableparsing_delimiter']['vDEF']) : '|';
     }
     // If some data has been submitted, then construct
     if (isset($this->TABLECFG['c'])) {
         // Process incoming:
         $this->changeFunc();
         // Convert to string (either line based or XML):
         if ($this->xmlStorage) {
             // Convert the input array to XML:
             $bodyText = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>' . LF . GeneralUtility::array2xml($this->TABLECFG['c'], '', 0, 'T3TableWizard');
             // Setting cfgArr directly from the input:
             $configuration = $this->TABLECFG['c'];
         } else {
             // Convert the input array to a string of configuration code:
             $bodyText = $this->cfgArray2CfgString($this->TABLECFG['c']);
             // Create cfgArr from the string based configuration - that way it is cleaned up
             // and any incompatibilities will be removed!
             $configuration = $this->cfgString2CfgArray($bodyText, $row[$this->colsFieldName]);
         }
         // If a save button has been pressed, then save the new field content:
         if ($_POST['_savedok'] || $_POST['_saveandclosedok']) {
             // Get DataHandler object:
             /** @var DataHandler $dataHandler */
             $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
             // Put content into the data array:
             $data = array();
             if ($this->P['flexFormPath']) {
                 // Current value of flexForm path:
                 $currentFlexFormData = GeneralUtility::xml2array($row[$this->P['field']]);
                 /** @var FlexFormTools $flexFormTools */
                 $flexFormTools = GeneralUtility::makeInstance(FlexFormTools::class);
                 $flexFormTools->setArrayValueByPath($this->P['flexFormPath'], $currentFlexFormData, $bodyText);
                 $data[$this->P['table']][$this->P['uid']][$this->P['field']] = $currentFlexFormData;
             } else {
                 $data[$this->P['table']][$this->P['uid']][$this->P['field']] = $bodyText;
             }
             // Perform the update:
             $dataHandler->start($data, array());
             $dataHandler->process_datamap();
             // If the save/close button was pressed, then redirect the screen:
             if ($_POST['_saveandclosedok']) {
                 HttpUtility::redirect(GeneralUtility::sanitizeLocalUrl($this->P['returnUrl']));
             }
         }
     } else {
         // If nothing has been submitted, load the $bodyText variable from the selected database row:
         if ($this->xmlStorage) {
             $configuration = GeneralUtility::xml2array($row[$this->P['field']]);
         } else {
             if ($this->P['flexFormPath']) {
                 // Current value of flexForm path:
                 $currentFlexFormData = GeneralUtility::xml2array($row[$this->P['field']]);
                 /** @var FlexFormTools $flexFormTools */
                 $flexFormTools = GeneralUtility::makeInstance(FlexFormTools::class);
                 $configuration = $flexFormTools->getArrayValueByPath($this->P['flexFormPath'], $currentFlexFormData);
                 $configuration = $this->cfgString2CfgArray($configuration, 0);
             } else {
                 // Regular line based table configuration:
                 $configuration = $this->cfgString2CfgArray($row[$this->P['field']], $row[$this->colsFieldName]);
             }
         }
         $configuration = is_array($configuration) ? $configuration : array();
     }
     return $configuration;
 }
    /**
     * Render a back button, if a returnUrl was provided
     *
     * @return string
     */
    protected function renderBackButton()
    {
        $backLink = '';
        $returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GET('returnUrl'));
        if ($returnUrl) {
            $backLink .= '
				<a class="btn btn-primary" href="' . htmlspecialchars($returnUrl) . '">
					' . $this->iconFactory->getIcon('actions-view-go-back', Icon::SIZE_SMALL)->render() . '
					' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:back', true) . '
				</a>';
        }
        return $backLink;
    }
 /**
  * Initializes the list generation
  *
  * @param int $id Page id for which the list is rendered. Must be >= 0
  * @param string $table Tablename - if extended mode where only one table is listed at a time.
  * @param int $pointer Browsing pointer.
  * @param string $search Search word, if any
  * @param int $levels Number of levels to search down the page tree
  * @param int $showLimit Limit of records to be listed.
  * @return void
  */
 public function start($id, $table, $pointer, $search = '', $levels = 0, $showLimit = 0)
 {
     $backendUser = $this->getBackendUserAuthentication();
     $db = $this->getDatabaseConnection();
     // Setting internal variables:
     // sets the parent id
     $this->id = (int) $id;
     if ($GLOBALS['TCA'][$table]) {
         // Setting single table mode, if table exists:
         $this->table = $table;
     }
     $this->firstElementNumber = $pointer;
     $this->searchString = trim($search);
     $this->searchLevels = (int) $levels;
     $this->showLimit = MathUtility::forceIntegerInRange($showLimit, 0, 10000);
     // Setting GPvars:
     $this->csvOutput = (bool) GeneralUtility::_GP('csv');
     $this->sortField = GeneralUtility::_GP('sortField');
     $this->sortRev = GeneralUtility::_GP('sortRev');
     $this->displayFields = GeneralUtility::_GP('displayFields');
     $this->duplicateField = GeneralUtility::_GP('duplicateField');
     if (GeneralUtility::_GP('justLocalized')) {
         $this->localizationRedirect(GeneralUtility::_GP('justLocalized'));
     }
     // Init dynamic vars:
     $this->counter = 0;
     $this->JScode = '';
     $this->HTMLcode = '';
     // Limits
     if (isset($this->modTSconfig['properties']['itemsLimitPerTable'])) {
         $this->itemsLimitPerTable = MathUtility::forceIntegerInRange((int) $this->modTSconfig['properties']['itemsLimitPerTable'], 1, 10000);
     }
     if (isset($this->modTSconfig['properties']['itemsLimitSingleTable'])) {
         $this->itemsLimitSingleTable = MathUtility::forceIntegerInRange((int) $this->modTSconfig['properties']['itemsLimitSingleTable'], 1, 10000);
     }
     // Set search levels:
     $searchLevels = $this->searchLevels;
     $this->perms_clause = $backendUser->getPagePermsClause(1);
     // This will hide records from display - it has nothing to do with user rights!!
     if ($pidList = $backendUser->getTSConfigVal('options.hideRecords.pages')) {
         if ($pidList = $db->cleanIntList($pidList)) {
             $this->perms_clause .= ' AND pages.uid NOT IN (' . $pidList . ')';
         }
     }
     // Get configuration of collapsed tables from user uc and merge with sanitized GP vars
     $this->tablesCollapsed = is_array($backendUser->uc['moduleData']['list']) ? $backendUser->uc['moduleData']['list'] : array();
     $collapseOverride = GeneralUtility::_GP('collapse');
     if (is_array($collapseOverride)) {
         foreach ($collapseOverride as $collapseTable => $collapseValue) {
             if (is_array($GLOBALS['TCA'][$collapseTable]) && ($collapseValue == 0 || $collapseValue == 1)) {
                 $this->tablesCollapsed[$collapseTable] = $collapseValue;
             }
         }
         // Save modified user uc
         $backendUser->uc['moduleData']['list'] = $this->tablesCollapsed;
         $backendUser->writeUC($backendUser->uc);
         $returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
         if ($returnUrl !== '') {
             HttpUtility::redirect($returnUrl);
         }
     }
     if ($searchLevels > 0) {
         $allowedMounts = $this->getSearchableWebmounts($this->id, $searchLevels, $this->perms_clause);
         $pidList = implode(',', $db->cleanIntArray($allowedMounts));
         $this->pidSelect = 'pid IN (' . $pidList . ')';
     } elseif ($searchLevels < 0) {
         // Search everywhere
         $this->pidSelect = '1=1';
     } else {
         $this->pidSelect = 'pid=' . (int) $id;
     }
     // Initialize languages:
     if ($this->localizationView) {
         $this->initializeLanguages();
     }
 }
 /**
  * Constructor function for the class
  *
  * @return void
  */
 protected function init()
 {
     $beUser = $this->getBackendUserAuthentication();
     // Page-selection permission clause (reading)
     $this->perms_clause = $beUser->getPagePermsClause(1);
     // This will hide records from display - it has nothing to do with user rights!!
     if ($pidList = $beUser->getTSConfigVal('options.hideRecords.pages')) {
         if ($pidList = $this->getDatabaseConnection()->cleanIntList($pidList)) {
             $this->perms_clause .= ' AND pages.uid NOT IN (' . $pidList . ')';
         }
     }
     // Setting GPvars:
     // The page id to operate from
     $this->id = (int) GeneralUtility::_GP('id');
     $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
     $this->pagesOnly = GeneralUtility::_GP('pagesOnly');
     // Setting up the context sensitive menu:
     $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
     $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Tooltip');
     // Creating content
     $this->content = '';
     $this->content .= '<h1>' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.pagetitle') . '</h1>';
     // Id a positive id is supplied, ask for the page record with permission information contained:
     if ($this->id > 0) {
         $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
     }
     // If a page-record was returned, the user had read-access to the page.
     if ($this->pageinfo['uid']) {
         // Get record of parent page
         $this->pidInfo = BackendUtility::getRecord('pages', $this->pageinfo['pid']);
         // Checking the permissions for the user with regard to the parent page: Can he create new pages, new
         // content record, new page after?
         if ($beUser->doesUserHaveAccess($this->pageinfo, 8)) {
             $this->newPagesInto = 1;
         }
         if ($beUser->doesUserHaveAccess($this->pageinfo, 16)) {
             $this->newContentInto = 1;
         }
         if (($beUser->isAdmin() || is_array($this->pidInfo)) && $beUser->doesUserHaveAccess($this->pidInfo, 8)) {
             $this->newPagesAfter = 1;
         }
     } elseif ($beUser->isAdmin()) {
         // Admins can do it all
         $this->newPagesInto = 1;
         $this->newContentInto = 1;
         $this->newPagesAfter = 0;
     } else {
         // People with no permission can do nothing
         $this->newPagesInto = 0;
         $this->newContentInto = 0;
         $this->newPagesAfter = 0;
     }
 }
示例#30
0
    /**
     * Returns JavaScript variables setting the returnUrl and thisScript location for use by JavaScript on the page.
     * Used in fx. db_list.php (Web>List)
     *
     * @param string $thisLocation URL to "this location" / current script
     * @return string Urls are returned as JavaScript variables T3_RETURN_URL and T3_THIS_LOCATION
     * @see typo3/db_list.php
     * @internal
     */
    public function redirectUrls($thisLocation = '')
    {
        $thisLocation = $thisLocation ? $thisLocation : GeneralUtility::linkThisScript(array('CB' => '', 'SET' => '', 'cmd' => '', 'popViewId' => ''));
        $out = '
	var T3_RETURN_URL = ' . GeneralUtility::quoteJSvalue(str_replace('%20', '', rawurlencode(GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'))))) . ';
	var T3_THIS_LOCATION = ' . GeneralUtility::quoteJSvalue(str_replace('%20', '', rawurlencode($thisLocation))) . '
		';
        return $out;
    }