示例#1
0
 /**
  * Returns banners matching the given demand
  *
  * @param \DERHANSEN\SfBanners\Domain\Model\BannerDemand $demand The demand
  * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
  */
 public function findDemanded(BannerDemand $demand)
 {
     /* Override the default sorting for random mode. Must be called before
        createQuery() */
     if ($demand->getDisplayMode() == 'allRandom') {
         $this->defaultOrderings = array();
     }
     $query = $this->createQuery();
     $constraints = array();
     if ($demand->getStartingPoint() != 0) {
         $pidList = GeneralUtility::intExplode(',', $demand->getStartingPoint(), true);
         $constraints[] = $query->in('pid', $pidList);
     }
     if ($demand->getCategories() != 0) {
         $categoryConstraints = array();
         $categories = GeneralUtility::intExplode(',', $demand->getCategories(), true);
         foreach ($categories as $category) {
             $categoryConstraints[] = $query->contains('category', $category);
         }
         if (count($categoryConstraints) > 0) {
             $constraints[] = $query->logicalOr($categoryConstraints);
         }
     }
     $query->matching($query->logicalAnd($constraints));
     /* Get banners without respect to limitations */
     $unfilteredResult = $query->execute();
     if ($unfilteredResult->count() > 0) {
         $finalQuery = $this->getQueryWithLimitation($unfilteredResult, $demand);
         $result = $this->getResult($finalQuery, $demand);
     } else {
         $result = $unfilteredResult;
     }
     return $result;
 }
 /**
  * Initializes the controller before invoking an action method.
  *
  * @return void
  */
 public function initializeAction()
 {
     if ($this->request->getPluginName() === 'Administration') {
         $this->logInUserRole = new Model\LoginUserRole();
         if ($this->getTypoScriptFrontendController()->loginUser) {
             $investigators = CoreUtility\GeneralUtility::intExplode(',', $this->settings['investigator'], true);
             $administrators = CoreUtility\GeneralUtility::intExplode(',', $this->settings['administrator'], true);
             // Check investigator access
             if (in_array((int) $this->getTypoScriptFrontendController()->fe_user->user[$this->getTypoScriptFrontendController()->fe_user->userid_column], $investigators)) {
                 $this->logInUserRole = new Model\LoginUserRole(Model\LoginUserRole::INVESTIGATOR);
             }
             // Check administrator access
             if (in_array((int) $this->getTypoScriptFrontendController()->fe_user->user[$this->getTypoScriptFrontendController()->fe_user->userid_column], $administrators)) {
                 $this->logInUserRole = new Model\LoginUserRole(Model\LoginUserRole::ADMINISTRATOR);
             }
         }
         if ($this->logInUserRole->isNotAuthorized()) {
             $this->getTypoScriptFrontendController()->pageNotFoundAndExit();
         } elseif ($this->logInUserRole->isInvestigator() && in_array($this->request->getControllerActionName(), $this->adminActions)) {
             $this->getTypoScriptFrontendController()->pageNotFoundAndExit();
         }
     }
     $settings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['project_registration']);
     $this->settings['warnXDaysBeforeExpireDate'] = $settings['warnXDaysBeforeExpireDate'];
     if (in_array($this->request->getControllerActionName(), $this->actionsThatRequireProjectArgumentToBeSet)) {
         $this->manuallySetProjectArgument();
     }
 }
示例#3
0
 /**
  * Returns a query for objects of this repository
  *
  * @return Tx_Extbase_Persistence_QueryInterface
  */
 public function createQuery()
 {
     $query = parent::createQuery();
     $constraints = array();
     if (!empty($this->queryOffset)) {
         $query->setOffset((int) $this->queryOffset);
     }
     if (!empty($this->queryLimit)) {
         $query->setLimit((int) $this->queryLimit);
     }
     if (!empty($this->queryOrderings)) {
         $query->setOrderings($this->queryOrderings);
     }
     if (!empty($this->storagePage)) {
         $query->getQuerySettings()->setRespectStoragePage(false);
         $pidList = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', Tx_T3devapi_Utility_Page::extendPidListByChildren($this->storagePage, 9999), true);
         $constraints[] = $query->in('pid', $pidList);
     }
     if (!empty($this->uidList)) {
         $uidList = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->uidList, true);
         $constraints[] = $query->in('uid', $uidList);
     }
     $constraints = $this->setSearchConstraints($query, $constraints);
     if (!empty($constraints)) {
         $query->matching($query->logicalAnd($constraints));
     }
     return $query;
 }
示例#4
0
 /**
  *
  */
 public function connect()
 {
     $this->ssh = new SSH2($this->configuration['hostname'], $this->configuration['port']);
     $authenticationMethod = $this->configuration[SftpDriver::CONFIG_AUTHENTICATION_METHOD];
     if (static::AUTHENTICATION_PASSWORD === (int) $authenticationMethod) {
         $authentication = $this->configuration['password'];
     } elseif (static::AUTHENTICATION_PUBKEY === (int) $authenticationMethod) {
         $authentication = new RSA();
         if (!empty($this->configuration['privateKeyPassword'])) {
             $authentication->setPassword($this->configuration['privateKeyPassword']);
         }
         $authentication->loadKey(file_get_contents($this->configuration['privateKey']));
     } else {
         throw new \LogicException('Wrong authentication type for phpseclibAdapter', 1476626149);
     }
     $sshConnected = $this->ssh->login($this->configuration['username'], $authentication);
     if ($sshConnected) {
         $this->sftp = new SFTP($this->configuration['hostname'], $this->configuration['port']);
         $sftpConnected = $this->sftp->login($this->configuration['username'], $authentication);
         if ($sftpConnected) {
             $this->info['userId'] = (int) $this->ssh->exec('echo $EUID');
             $this->info['groupIds'] = GeneralUtility::intExplode(' ', $this->ssh->exec('echo ${GROUPS[*]}'), true);
             return true;
         }
     }
     return false;
 }
示例#5
0
 /**
  * Process field data to split in an array
  *
  * @param ContentObjectRenderer $cObj The data of the content element or page
  * @param array $contentObjectConfiguration The configuration of Content Object
  * @param array $processorConfiguration The configuration of this processor
  * @param array $processedData Key/value store of processed data (e.g. to be passed to a Fluid View)
  * @return array the processed data as key/value store
  */
 public function process(ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData)
 {
     if (isset($processorConfiguration['if.']) && !$cObj->checkIf($processorConfiguration['if.'])) {
         return $processedData;
     }
     // The field name to process
     $fieldName = $cObj->stdWrapValue('fieldName', $processorConfiguration);
     if (empty($fieldName)) {
         return $processedData;
     }
     $originalValue = $cObj->data[$fieldName];
     // Set the target variable
     $targetVariableName = $cObj->stdWrapValue('as', $processorConfiguration, $fieldName);
     // Set the delimiter which is "LF" by default
     $delimiter = $cObj->stdWrapValue('delimiter', $processorConfiguration, LF);
     // Filter integers
     $filterIntegers = (bool) $cObj->stdWrapValue('filterIntegers', $processorConfiguration, false);
     // Filter unique
     $filterUnique = (bool) $cObj->stdWrapValue('filterUnique', $processorConfiguration, false);
     // Remove empty entries
     $removeEmptyEntries = (bool) $cObj->stdWrapValue('removeEmptyEntries', $processorConfiguration, false);
     if ($filterIntegers === true) {
         $processedData[$targetVariableName] = GeneralUtility::intExplode($delimiter, $originalValue, $removeEmptyEntries);
     } else {
         $processedData[$targetVariableName] = GeneralUtility::trimExplode($delimiter, $originalValue, $removeEmptyEntries);
     }
     if ($filterUnique === true) {
         $processedData[$targetVariableName] = array_unique($processedData[$targetVariableName]);
     }
     return $processedData;
 }
 /**
  * Get a list of addresses.
  *
  * @param string $uids A comma separeted list of uids
  *
  * @return QueryResultInterface|array
  */
 public function findByUids($uids)
 {
     $query = $this->createQuery();
     $query->getQuerySettings()->setRespectStoragePage(false);
     $query->matching($query->in('uid', GeneralUtility::intExplode(',', $uids)));
     return $query->execute();
 }
示例#7
0
 /**
  * Displays the form editor
  *
  * @param string $formPersistenceIdentifier
  * @param string $prototypeName
  * @return void
  * @throws PersistenceManagerException
  * @internal
  */
 public function indexAction(string $formPersistenceIdentifier, string $prototypeName = null)
 {
     $this->registerDocheaderButtons();
     $this->view->getModuleTemplate()->setModuleName($this->request->getPluginName() . '_' . $this->request->getControllerName());
     $this->view->getModuleTemplate()->setFlashMessageQueue($this->controllerContext->getFlashMessageQueue());
     if (strpos($formPersistenceIdentifier, 'EXT:') === 0 && !$this->formSettings['persistenceManager']['allowSaveToExtensionPaths']) {
         throw new PersistenceManagerException('Edit a extension formDefinition is not allowed.', 1478265661);
     }
     $formDefinition = $this->formPersistenceManager->load($formPersistenceIdentifier);
     $formDefinition = ArrayUtility::stripTagsFromValuesRecursive($formDefinition);
     if (empty($prototypeName)) {
         $prototypeName = isset($formDefinition['prototypeName']) ? $formDefinition['prototypeName'] : 'standard';
     }
     $formDefinition['prototypeName'] = $prototypeName;
     $configurationService = $this->objectManager->get(ConfigurationService::class);
     $this->prototypeConfiguration = $configurationService->getPrototypeConfiguration($prototypeName);
     $formEditorDefinitions = $this->getFormEditorDefinitions();
     $formEditorAppInitialData = ['formEditorDefinitions' => $formEditorDefinitions, 'formDefinition' => $formDefinition, 'formPersistenceIdentifier' => $formPersistenceIdentifier, 'prototypeName' => $prototypeName, 'endpoints' => ['formPageRenderer' => $this->controllerContext->getUriBuilder()->uriFor('renderFormPage'), 'saveForm' => $this->controllerContext->getUriBuilder()->uriFor('saveForm')], 'additionalViewModelModules' => $this->prototypeConfiguration['formEditor']['dynamicRequireJsModules']['additionalViewModelModules'], 'maximumUndoSteps' => $this->prototypeConfiguration['formEditor']['maximumUndoSteps']];
     $this->view->assign('formEditorAppInitialData', json_encode($formEditorAppInitialData));
     $this->view->assign('stylesheets', $this->resolveResourcePaths($this->prototypeConfiguration['formEditor']['stylesheets']));
     $this->view->assign('formEditorTemplates', $this->renderFormEditorTemplates($this->prototypeConfiguration['formEditor']['formEditorTemplates'], $formEditorDefinitions));
     $this->view->assign('dynamicRequireJsModules', $this->prototypeConfiguration['formEditor']['dynamicRequireJsModules']);
     $popupWindowWidth = 700;
     $popupWindowHeight = 750;
     $popupWindowSize = $this->getBackendUser()->getTSConfigVal('options.popupWindowSize') ? trim($this->getBackendUser()->getTSConfigVal('options.popupWindowSize')) : null;
     if (!empty($popupWindowSize)) {
         list($popupWindowWidth, $popupWindowHeight) = GeneralUtility::intExplode('x', $popupWindowSize);
     }
     $addInlineSettings = ['FormEditor' => ['typo3WinBrowserUrl' => BackendUtility::getModuleUrl('wizard_element_browser')], 'Popup' => ['PopupWindow' => ['width' => $popupWindowWidth, 'height' => $popupWindowHeight]]];
     $addInlineSettings = array_replace_recursive($addInlineSettings, $this->prototypeConfiguration['formEditor']['addInlineSettings']);
     $this->view->assign('addInlineSettings', $addInlineSettings);
 }
示例#8
0
 /**
  * Render the teaser action
  *
  * @cache 1h
  */
 public function teaserAction()
 {
     $topQuestions = GeneralUtility::intExplode(',', $this->settings['faq']['topQuestions'], true);
     $teaserCategories = GeneralUtility::intExplode(',', $this->settings['faq']['teaserCategories'], true);
     $teaserLimit = (int) $this->settings['faq']['teaserLimit'];
     $questions = $this->questionRepository->findByTeaserConfiguration($topQuestions, $teaserCategories, $teaserLimit);
     $this->view->assign('questions', $questions);
 }
示例#9
0
 /**
  * Find notes by given pids and author
  *
  * @param string $pids Single PID or comma separated list of PIDs
  * @param \TYPO3\CMS\Extbase\Domain\Model\BackendUser $author The author
  * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
  */
 public function findByPidsAndAuthor($pids, \TYPO3\CMS\Extbase\Domain\Model\BackendUser $author)
 {
     $pids = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', (string) $pids);
     $query = $this->createQuery();
     $query->setOrderings(array('sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING, 'creationDate' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING));
     $query->matching($query->logicalAnd($query->in('pid', $pids), $query->logicalOr($query->equals('personal', 0), $query->equals('author', $author))));
     return $query->execute();
 }
示例#10
0
 /**
  * Wrapper method for t3lib_div::intExplode()
  * @param string $delimiter
  * @param string $string
  * @param boolean $onlyNonEmptyValues
  * @param int $limit
  */
 public static function intExplode($delimiter, $string, $onlyNonEmptyValues = FALSE, $limit = 0)
 {
     tx_rnbase::load('tx_rnbase_util_TYPO3');
     if (tx_rnbase_util_TYPO3::isTYPO60OrHigher()) {
         return \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode($delimiter, $string, $onlyNonEmptyValues, $limit);
     } else {
         return t3lib_div::intExplode($delimiter, $string, $onlyNonEmptyValues, $limit);
     }
 }
 /**
  * @param $uidList
  *
  * @return array|NULL
  * @throws \Exception
  */
 public function findByUidList($uidList)
 {
     $list = implode(',', GeneralUtility::intExplode(',', $uidList, 1));
     if ($list != '') {
         return $this->getDb()->exec_SELECTgetRows('*', $this->getTable(), 'uid IN (' . $list . ')' . DatabaseFactory::enableFields($this->getTable()), '', 'FIELD(uid, ' . $list . ')');
     } else {
         return array();
     }
 }
 /**
  * Generates extension site map.
  *
  * @return    void
  */
 protected function generateSitemapContent()
 {
     $selector = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('selector'));
     $typoscriptSelector = $selector . '.';
     $currentSetup = $GLOBALS['TSFE']->tmpl->setup['plugin.']['dd_googlesitemap_dmf.'][$typoscriptSelector];
     $pidList = $currentSetup['pidList'] ? \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $currentSetup['pidList']) : $this->pidList;
     $catList = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('catList') ? \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('catList')) : \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $currentSetup['catList']);
     $catMMList = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('catMMList') ? \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('catMMList')) : \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $currentSetup['catMMList']);
     $currentSetup['singlePid'] = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('singlePid') ? intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('singlePid')) : intval($currentSetup['singlePid']);
     $currentSetup['languageUid'] = '';
     if (!$currentSetup['disableLanguageCheck']) {
         if (is_int($GLOBALS['TSFE']->sys_language_uid)) {
             // set language through TSFE checkup
             $currentSetup['languageUid'] = intval($GLOBALS['TSFE']->sys_language_uid);
         }
         if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('L')) {
             // overwrites if L param is set
             $currentSetup['languageUid'] = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('L'));
         }
     }
     if (count($pidList) > 0 && isset($selector) && isset($currentSetup)) {
         $table = $currentSetup['sqlMainTable'];
         $mmTable = $currentSetup['sqlMMTable'];
         $catColumn = $currentSetup['sqlCatColumn'];
         $sqlCondition = $catColumn && count($catList) > 0 && $catList[0] > 0 ? ' AND ' . $catColumn . ' IN (' . implode(',', $catList) . ')' : '';
         $sqlMMCondition = $sqlMMTable = '';
         if ($mmTable != '' && count($catMMList) > 0 && $catMMList[0] > 0) {
             $sqlMMTable = ',' . $mmTable;
             $sqlMMCondition = ' AND ' . $table . '.uid = ' . $mmTable . '.uid_local AND ' . $mmTable . '.uid_foreign IN (' . implode(',', $catMMList) . ')';
         }
         $newsSelect = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('type') == 'news' ? ',' . $currentSetup['sqlTitle'] . ',' . $currentSetup['sqlKeywords'] : '';
         $languageWhere = is_int($currentSetup['languageUid']) ? ' AND ' . $table . '.sys_language_uid=' . $currentSetup['languageUid'] : '';
         if ($table == 'tx_news_domain_model_news') {
             $noInternalURLwhere = ' AND (' . $table . '.internalurl=FALSE OR ' . $table . ' .internalurl IS NULL)';
             $noExternalURLwhere = ' AND (' . $table . '.externalurl=FALSE  OR ' . $table . ' .externalurl IS NULL)';
         } else {
             $noInternalURLwhere = '';
             $noExternalURLwhere = '';
         }
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,' . $currentSetup['sqlLastUpdated'] . $newsSelect, $table . $sqlMMTable, 'pid IN (' . implode(',', $pidList) . ')' . $sqlCondition . $sqlMMCondition . $this->cObj->enableFields($table) . $languageWhere . $noInternalURLwhere . $noExternalURLwhere, 'uid', $currentSetup['sqlOrder'] ? $currentSetup['sqlOrder'] : '');
         $rowCount = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
         while (FALSE !== ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) {
             if ($url = $this->getVariousItemUrl($row['uid'], $currentSetup)) {
                 $frequency = $currentSetup['frequency'] ? $currentSetup['frequency'] : $this->getChangeFrequency($row[$currentSetup['sqlLastUpdated']]);
                 echo $this->renderer->renderEntry($url, $row[$currentSetup['sqlTitle']], $row[$currentSetup['sqlLastUpdated']], $frequency, $row[$currentSetup['sqlKeywords']]);
             }
         }
         $GLOBALS['TYPO3_DB']->sql_free_result($res);
         if ($rowCount === 0) {
             echo '<!-- It appears that there are no extension entries. If your ' . 'storage sysfolder is outside of the rootline, you may ' . 'want to use the dd_googlesitemap.skipRootlineCheck=1 TS ' . 'setup option. Beware: it is insecure and may cause certain ' . 'undesired effects! Better move your pid sysfolder ' . 'inside the rootline! -->';
         } elseif (!$rowCount) {
             echo '<!-- There is an sql error. please check all corresponding sql fields in your typoscript setup. -->';
         }
     } else {
         echo 'There is something wrong with the config. Please check your selector and pidList elements. You may ' . 'want to use the dd_googlesitemap.skipRootlineCheck=1 TS ' . 'setup option if your storage sysfolder is outside the rootline. Beware: it is insecure and may cause certain ' . 'undesired effects! Better move your pid sysfolder ' . 'inside the rootline! -->';
     }
 }
示例#13
0
 /**
  * Find Form objects by its given uids
  *
  * @param string $uids commaseparated list of uids
  * @return \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult
  */
 public function findByUids($uids)
 {
     $query = $this->createQuery();
     $query->getQuerySettings()->setRespectStoragePage(FALSE);
     $query->getQuerySettings()->setRespectSysLanguage(FALSE);
     $query->matching($query->in('uid', GeneralUtility::intExplode(',', $uids, TRUE)));
     $result = $query->execute();
     return $result;
 }
 /**
  * @param $uidList
  *
  * @return array|NULL
  * @throws \Exception
  */
 public function findByUidList($uidList)
 {
     $list = implode(',', GeneralUtility::intExplode(',', $uidList, 1));
     if ($list != '') {
         return $this->getDb()->exec_SELECTgetRows('*', $this->getTable(), 'uid IN (' . $list . ')' . DatabaseFactory::enableFields($this->getTable()), '', 'FIELD(uid, ' . $list . ')');
     } else {
         throw new \Exception('Given uid list does not contain uids! Table: ' . $this->getTable());
     }
 }
 /**
  * @param $pidList
  * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
  */
 public function findByStartingPoint($pidList)
 {
     $query = $this->getQuery();
     $pidList = GeneralUtility::intExplode(',', $pidList, TRUE);
     if (!empty($pidList)) {
         return $query->matching($query->logicalAnd($query->in('pid', $pidList)))->execute();
     }
     return $query->execute();
 }
示例#16
0
 /**
  * Explodes a comma-separated list of integer values and sorts them
  * numerically.
  *
  * @param string $valueList comma-separated list of values, may be empty
  *
  * @return int[] the separate values, sorted numerically, may be empty
  */
 private function sortExplode($valueList)
 {
     if ($valueList == '') {
         return array();
     }
     $numbers = GeneralUtility::intExplode(',', $valueList);
     sort($numbers, SORT_NUMERIC);
     return $numbers;
 }
示例#17
0
 /**
  * Find by list or array or uids
  *
  * @param array|string $uids
  *
  * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
  */
 public function findByUids($uids)
 {
     $query = $this->createQuery();
     if (!is_array($uids)) {
         $uids = GeneralUtility::intExplode(',', $uids);
     }
     $query->setOrderings(array('sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING));
     $query->matching($query->in('uid', $uids));
     return $query->execute();
 }
示例#18
0
 /**
  * Generate the information field
  *
  * @param array $configuration
  * @param object $fObj
  *
  * @return string
  */
 public function informationGroupField($configuration, $fObj)
 {
     $ids = GeneralUtility::intExplode(',', $configuration['row']['configurations'], true);
     if (!sizeof($ids)) {
         return $this->wrapContent(TranslateUtility::get('save.first'));
     }
     /** @var TimeTableService $timeTableService */
     $timeTableService = GeneralUtility::makeInstance('HDNET\\Calendarize\\Service\\TimeTableService');
     $items = $timeTableService->getTimeTablesByConfigurationIds($ids);
     return $this->wrapContent($this->getEventList($items));
 }
 /**
  * Main function, rendering the element browser in RTE mode.
  *
  * @return void
  */
 public function main()
 {
     // Setting alternative web browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
     $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.altElementBrowserMountPoints'));
     $appendAltMountPoints = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.altElementBrowserMountPoints.append');
     // Clear temporary DB mounts
     $tmpMount = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('setTempDBmount');
     if (isset($tmpMount)) {
         $GLOBALS['BE_USER']->setAndSaveSessionData('pageTree_temporaryMountPoint', (int) $tmpMount);
     }
     // Set temporary DB mounts
     $tempDBmount = (int) $GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint');
     if ($tempDBmount) {
         $altMountPoints = $tempDBmount;
         $appendAltMountPoints = FALSE;
     }
     if ($altMountPoints) {
         $alternativeMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $altMountPoints);
         $GLOBALS['BE_USER']->setWebmounts($alternativeMountPoints, $appendAltMountPoints);
     }
     // Setting alternative file browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
     $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
     if ($altMountPoints) {
         $altMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $altMountPoints);
         foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
             // @todo: add this feature for FAL and TYPO3 6.2
         }
     }
     // Render type by user function
     $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 = \TYPO3\CMS\Core\Utility\GeneralUtility::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) {
         $GLOBALS['SOBE']->browser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Rtehtmlarea\BrowseLinks::class);
         $GLOBALS['SOBE']->browser->init();
         $modData = $GLOBALS['BE_USER']->getModuleData('browse_links.php', 'ses');
         list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData);
         $GLOBALS['BE_USER']->pushModuleData('browse_links.php', $modData);
         $this->content = $GLOBALS['SOBE']->browser->main_rte();
     }
 }
 /**
  * @param $list
  *
  * @return array|NULL
  */
 public function findByIdList($list)
 {
     if (!is_array($list)) {
         $list = GeneralUtility::intExplode(',', $list, 1);
     }
     $uidList = implode(',', $list);
     if ($uidList != '') {
         $result = $this->getDb()->exec_SELECTgetRows('*', $this->getTable(), 'uid IN (' . $uidList . ')' . DatabaseFactory::enableFields($this->getTable()));
     } else {
         $result = array();
     }
     return $result;
 }
 /**
  * Returns all categories depending on the settings in the demand object
  *
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Dto\ForeignRecordDemand $demand ForeignRecordDemand
  *
  * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
  */
 public function findDemanded($demand)
 {
     $constraints = [];
     $query = $this->createQuery();
     if ($demand->getRestrictForeignRecordsToStoragePage()) {
         $pidList = GeneralUtility::intExplode(',', $demand->getStoragePage(), true);
         $constraints[] = $query->in('pid', $pidList);
     }
     if (count($constraints) > 0) {
         $query->matching($query->logicalAnd($constraints));
     }
     return $query->execute();
 }
示例#22
0
 /**
  * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $categories
  * @return \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult
  */
 protected function removeExcludeCategories(\TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $categories)
 {
     $excludeCategories = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->settings['excludeCategories']);
     if (count($excludeCategories)) {
         /** @var $category \Evoweb\SfBooks\Domain\Model\Category */
         foreach ($categories as $category) {
             if (in_array($category->getUid(), $excludeCategories)) {
                 $categories->offsetUnset($categories->key());
             }
         }
     }
     return $categories;
 }
示例#23
0
 /**
  * Creates a query object working on the given class name
  *
  * @param string $className The class name
  * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
  * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception
  */
 public function create($className)
 {
     $query = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\QueryInterface::class, $className);
     $querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class);
     $dataMap = $this->dataMapper->getDataMap($className);
     if ($dataMap->getIsStatic() || $dataMap->getRootLevel()) {
         $querySettings->setRespectStoragePage(false);
     }
     $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     $querySettings->setStoragePageIds(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $frameworkConfiguration['persistence']['storagePid']));
     $query->setQuerySettings($querySettings);
     return $query;
 }
示例#24
0
 /**
  * Process data of a record to resolve File objects to the view
  *
  * @param ContentObjectRenderer $cObj The data of the content element or page
  * @param array $contentObjectConfiguration The configuration of Content Object
  * @param array $processorConfiguration The configuration of this processor
  * @param array $processedData Key/value store of processed data (e.g. to be passed to a Fluid View)
  * @return array the processed data as key/value store
  */
 public function process(ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData)
 {
     if (isset($processorConfiguration['if.']) && !$cObj->checkIf($processorConfiguration['if.'])) {
         return $processedData;
     }
     // gather data
     /** @var FileCollector $fileCollector */
     $fileCollector = GeneralUtility::makeInstance(FileCollector::class);
     // references / relations
     if (!empty($processorConfiguration['references.'])) {
         $referenceConfiguration = $processorConfiguration['references.'];
         $relationField = $cObj->stdWrapValue('fieldName', $referenceConfiguration);
         // If no reference fieldName is set, there's nothing to do
         if (!empty($relationField)) {
             // Fetch the references of the default element
             $relationTable = $cObj->stdWrapValue('table', $referenceConfiguration, $cObj->getCurrentTable());
             if (!empty($relationTable)) {
                 $fileCollector->addFilesFromRelation($relationTable, $relationField, $cObj->data);
             }
         }
     }
     // files
     $files = $cObj->stdWrapValue('files', $processorConfiguration);
     if ($files) {
         $files = GeneralUtility::intExplode(',', $files, TRUE);
         $fileCollector->addFiles($files);
     }
     // collections
     $collections = $cObj->stdWrapValue('collections', $processorConfiguration);
     if (!empty($collections)) {
         $collections = GeneralUtility::trimExplode(',', $collections, TRUE);
         $fileCollector->addFilesFromFileCollections($collections);
     }
     // folders
     $folders = $cObj->stdWrapValue('folders', $processorConfiguration);
     if (!empty($folders)) {
         $folders = GeneralUtility::trimExplode(',', $folders, TRUE);
         $fileCollector->addFilesFromFolders($folders);
     }
     // make sure to sort the files
     $sortingProperty = $cObj->stdWrapValue('sorting', $processorConfiguration);
     if ($sortingProperty) {
         $sortingDirection = $cObj->stdWrapValue('direction', isset($processorConfiguration['sorting.']) ? $processorConfiguration['sorting.'] : array(), 'ascending');
         $fileCollector->sort($sortingProperty, $sortingDirection);
     }
     // set the files into a variable, default "files"
     $targetVariableName = $cObj->stdWrapValue('as', $processorConfiguration, 'files');
     $processedData[$targetVariableName] = $fileCollector->getFiles();
     return $processedData;
 }
示例#25
0
 /**
  * Check if the note plugin expects output. If there are no sys_note records on the given
  * pages, the extbase bootstrap doesn't have to run the complete plugin.
  * This mechanism should increase the performance of the hooked backend modules heavily.
  *
  * @param array $arguments Arguments for the extbase plugin
  * @return bool
  */
 protected function expectOutput(array $arguments = [])
 {
     // no pids set
     if (!isset($arguments['pids']) || empty($arguments['pids']) || empty($GLOBALS['BE_USER']->user['uid'])) {
         return false;
     }
     $cleanedPageIds = GeneralUtility::intExplode(',', $arguments['pids'], true);
     if (empty($cleanedPageIds)) {
         return false;
     }
     $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_note');
     $count = $queryBuilder->count('uid')->from('sys_note')->where($queryBuilder->expr()->in('pid', $queryBuilder->createNamedParameter($cleanedPageIds, Connection::PARAM_INT_ARRAY)))->execute()->fetchColumn();
     return (bool) $count;
 }
示例#26
0
 /**
  * Creates a query object working on the given class name
  *
  * Adds the ability to set storagePids for any domain object using typoscript:
  * config.extBase.persistence.classes.CLASSNAME.storagePid
  *
  * Not implemented here, but you should also set the newRecordStoragePid too:
  * config.extBase.persistence.classes.CLASSNAME.newRecordStoragePid
  *
  * @param string $className The class name
  * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
  */
 public function create($className)
 {
     $query = $this->objectManager->create('TYPO3\\CMS\\Extbase\\Persistence\\QueryInterface', $className);
     $querySettings = $this->objectManager->create('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
     $frameworkConfiguration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     $classes = $frameworkConfiguration['persistence']['classes'];
     if (isset($classes[$className]) && !empty($classes[$className]['storagePid'])) {
         $storagePids = GeneralUtility::intExplode(',', $classes[$className]['storagePid']);
     } else {
         $storagePids = GeneralUtility::intExplode(',', $frameworkConfiguration['persistence']['storagePid']);
     }
     $querySettings->setStoragePageIds($storagePids);
     $query->setQuerySettings($querySettings);
     return $query;
 }
示例#27
0
 /**
  * Render unordered list for pages
  *
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $uids = $arguments['uids'];
     if (!$uids) {
         return '';
     }
     $content = '';
     $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
     $queryBuilder->getRestrictions()->removeAll();
     $res = $queryBuilder->select('uid', 'title')->from('pages')->where($queryBuilder->expr()->in('uid', $queryBuilder->createNamedParameter(GeneralUtility::intExplode(',', $uids), Connection::PARAM_INT_ARRAY)))->orderBy('uid', 'ASC')->execute();
     while ($row = $res->fetch()) {
         $content .= '<li>' . htmlspecialchars($row['title']) . ' [' . htmlspecialchars($row['uid']) . ']</li>';
     }
     return '<ul>' . $content . '</ul>';
 }
示例#28
0
 /**
  * Check if the note plugin expects output. If there are no sys_note records on the given
  * pages, the extbase bootstrap doesn't have to run the complete plugin.
  * This mechanism should increase the performance of the hooked backend modules heavily.
  *
  * @param array $arguments Arguments for the extbase plugin
  * @return bool
  */
 protected function expectOutput(array $arguments = array())
 {
     // no pids set
     if (!isset($arguments['pids']) || empty($arguments['pids']) || empty($GLOBALS['BE_USER']->user['uid'])) {
         return false;
     }
     $pidList = GeneralUtility::intExplode(',', $arguments['pids'], true);
     if (empty($pidList)) {
         return false;
     }
     /** @var QueryBuilder $queryBuilder */
     $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_note');
     $count = $queryBuilder->count('uid')->from('sys_note')->where($queryBuilder->expr()->in('pid', $pidList))->execute()->fetchColumn();
     return (bool) $count;
 }
示例#29
0
 /**
  * Returns an array of constraints created from a given demand object.
  *
  * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
  * @param Tx_MooxNews_Domain_Model_DemandInterface $demand
  * @return array<\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface>
  */
 protected function createConstraintsFromDemand(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query, Tx_MooxNews_Domain_Model_DemandInterface $demand)
 {
     $constraints = array();
     // Storage page
     if ($demand->getStoragePage() != 0) {
         $pidList = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $demand->getStoragePage(), TRUE);
         $constraints[] = $query->in('pid', $pidList);
     }
     // Clean not used constraints
     foreach ($constraints as $key => $value) {
         if (is_null($value)) {
             unset($constraints[$key]);
         }
     }
     return $constraints;
 }
示例#30
0
 /**
  * Returns an array of constraints created from a given demand object.
  *
  * @param QueryInterface $query
  * @param DemandInterface $demand
  * @return array<\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface>
  */
 protected function createConstraintsFromDemand(QueryInterface $query, DemandInterface $demand)
 {
     $constraints = array();
     // Storage page
     if ($demand->getStoragePage() != 0) {
         $pidList = GeneralUtility::intExplode(',', $demand->getStoragePage(), TRUE);
         $constraints[] = $query->in('pid', $pidList);
     }
     // Clean not used constraints
     foreach ($constraints as $key => $value) {
         if (is_null($value)) {
             unset($constraints[$key]);
         }
     }
     return $constraints;
 }