示例#1
1
 /**
  * Returns information about this extension plugin
  *
  * @param array $params Parameters to the hook
  *
  * @return string Information about pi1 plugin
  * @hook TYPO3_CONF_VARS|SC_OPTIONS|cms/layout/class.tx_cms_layout.php|list_type_Info|calendarize_calendar
  */
 public function getExtensionSummary(array $params)
 {
     $relIconPath = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . ExtensionManagementUtility::siteRelPath('calendarize') . 'ext_icon.png';
     $this->flexFormService = GeneralUtility::makeInstance('HDNET\\Calendarize\\Service\\FlexFormService');
     $this->layoutService = GeneralUtility::makeInstance('HDNET\\Calendarize\\Service\\ContentElementLayoutService');
     $this->layoutService->setTitle('<img src="' . $relIconPath . '" /> Calendarize');
     if ($params['row']['list_type'] != 'calendarize_calendar') {
         return '';
     }
     $this->flexFormService->load($params['row']['pi_flexform']);
     if (!$this->flexFormService->isValid()) {
         return '';
     }
     $actions = $this->flexFormService->get('switchableControllerActions', 'main');
     $parts = GeneralUtility::trimExplode(';', $actions, true);
     $parts = array_map(function ($element) {
         $split = explode('->', $element);
         return ucfirst($split[1]);
     }, $parts);
     $actionKey = lcfirst(implode('', $parts));
     $this->layoutService->addRow(LocalizationUtility::translate('mode', 'calendarize'), LocalizationUtility::translate('mode.' . $actionKey, 'calendarize'));
     $this->layoutService->addRow(LocalizationUtility::translate('configuration', 'calendarize'), $this->flexFormService->get('settings.configuration', 'main'));
     if ((bool) $this->flexFormService->get('settings.hidePagination', 'main')) {
         $this->layoutService->addRow(LocalizationUtility::translate('hide.pagination.teaser', 'calendarize'), '!!!');
     }
     $this->addPageIdsToTable();
     return $this->layoutService->render();
 }
示例#2
1
 /**
  * Render the captcha image html
  *
  * @param string suffix to be appended to the extenstion key when forming css class names
  * @return string The html used to render the captcha image
  */
 public function render($suffix = '')
 {
     $value = '';
     // Include the required JavaScript
     $GLOBALS['TSFE']->additionalHeaderData[$this->extensionKey . '_freeCap'] = '<script type="text/javascript" src="' . GeneralUtility::createVersionNumberedFilename(ExtensionManagementUtility::siteRelPath($this->extensionKey) . 'Resources/Public/JavaScript/freeCap.js') . '"></script>';
     // Disable caching
     $GLOBALS['TSFE']->no_cache = 1;
     // Get the plugin configuration
     $settings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, $this->extensionName);
     // Get the translation view helper
     $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $translator = $objectManager->get('SJBR\\SrFreecap\\ViewHelpers\\TranslateViewHelper');
     $translator->injectConfigurationManager($this->configurationManager);
     // Generate the image url
     $fakeId = GeneralUtility::shortMD5(uniqid(rand()), 5);
     $siteURL = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
     $L = GeneralUtility::_GP('L');
     $urlParams = array('eID' => 'sr_freecap_EidDispatcher', 'id' => $GLOBALS['TSFE']->id, 'vendorName' => 'SJBR', 'extensionName' => 'SrFreecap', 'pluginName' => 'ImageGenerator', 'controllerName' => 'ImageGenerator', 'actionName' => 'show', 'formatName' => 'png', 'L' => $GLOBALS['TSFE']->sys_language_uid);
     if ($GLOBALS['TSFE']->MP) {
         $urlParams['MP'] = $GLOBALS['TSFE']->MP;
     }
     $urlParams['set'] = $fakeId;
     $imageUrl = $siteURL . 'index.php?' . ltrim(GeneralUtility::implodeArrayForUrl('', $urlParams), '&');
     // Generate the html text
     $value = '<img' . $this->getClassAttribute('image', $suffix) . ' id="tx_srfreecap_captcha_image_' . $fakeId . '"' . ' src="' . htmlspecialchars($imageUrl) . '"' . ' alt="' . $translator->render('altText') . ' "/>' . '<span' . $this->getClassAttribute('cant-read', $suffix) . '>' . $translator->render('cant_read1') . ' <a href="#" onclick="this.blur();' . $this->extensionName . '.newImage(\'' . $fakeId . '\', \'' . $translator->render('noImageMessage') . '\');return false;">' . $translator->render('click_here') . '</a>' . $translator->render('cant_read2') . '</span>';
     return $value;
 }
示例#3
0
 /**
  * Boots up:
  *  - objectManager to get class instances
  *  - configuration manager for ts settings
  *  - contentObjectRenderer for generating links etc.
  *  - termRepository to get the Terms
  *
  * @return WrapperService
  */
 public function __construct()
 {
     // Make instance of Object Manager
     /** @var ObjectManager $objectManager */
     $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     // Get Configuration Manager
     /** @var ConfigurationManager $configurationManager */
     $configurationManager = $objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
     // Inject Content Object Renderer
     $this->cObj = $objectManager->get('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     // Get Query Settings
     /** @var QuerySettingsInterface $querySettings */
     $querySettings = $objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
     // Get termRepository
     $this->termRepository = $objectManager->get('Dpn\\DpnGlossary\\Domain\\Repository\\TermRepository');
     // Get Typoscript Configuration
     $this->tsConfig = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
     // Reduce TS config to plugin
     $this->tsConfig = $this->tsConfig['plugin.']['tx_dpnglossary.'];
     if (FALSE === empty($this->tsConfig)) {
         // Save extension settings without ts dots
         $this->settings = GeneralUtility::removeDotsFromTS($this->tsConfig['settings.']);
         // Set StoragePid in the query settings object
         $querySettings->setStoragePageIds(GeneralUtility::trimExplode(',', $this->tsConfig['persistence.']['storagePid']));
         // Set current language uid
         $querySettings->setLanguageUid($GLOBALS['TSFE']->sys_language_uid);
         // Assign query settings object to repository
         $this->termRepository->setDefaultQuerySettings($querySettings);
     }
 }
 /**
  * Determine the url to view
  *
  * @return string
  */
 protected function getTargetUrl()
 {
     $pageIdToShow = (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');
     $adminCommand = $this->getAdminCommand($pageIdToShow);
     $domainName = $this->getDomainName($pageIdToShow);
     // Mount point overlay: Set new target page id and mp parameter
     /** @var \TYPO3\CMS\Frontend\Page\PageRepository $sysPage */
     $sysPage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
     $sysPage->init(FALSE);
     $mountPointMpParameter = '';
     $finalPageIdToShow = $pageIdToShow;
     $mountPointInformation = $sysPage->getMountPointInfo($pageIdToShow);
     if ($mountPointInformation && $mountPointInformation['overlay']) {
         // New page id
         $finalPageIdToShow = $mountPointInformation['mount_pid'];
         $mountPointMpParameter = '&MP=' . $mountPointInformation['MPvar'];
     }
     // Modify relative path to protocol with host if domain record is given
     $protocolAndHost = '..';
     if ($domainName) {
         $protocol = 'http';
         $page = (array) $sysPage->getPage($finalPageIdToShow);
         if ($page['url_scheme'] == 2 || $page['url_scheme'] == 0 && \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SSL')) {
             $protocol = 'https';
         }
         $protocolAndHost = $protocol . '://' . $domainName;
     }
     $url = $protocolAndHost . '/index.php?id=' . $finalPageIdToShow . $this->getTypeParameterIfSet($finalPageIdToShow) . $mountPointMpParameter . $adminCommand;
     return $url;
 }
示例#5
0
 /**
  * Prepare a DatabaseConnection subject.
  * Used by driver specific test cases.
  *
  * @param string $driver Driver to use like "mssql", "oci8" and "postgres7"
  * @param array $configuration Dbal configuration array
  * @return \TYPO3\CMS\Dbal\Database\DatabaseConnection|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface
  */
 protected function prepareSubject($driver, array $configuration)
 {
     /** @var \TYPO3\CMS\Dbal\Database\DatabaseConnection|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface $subject */
     $subject = $this->getAccessibleMock(\TYPO3\CMS\Dbal\Database\DatabaseConnection::class, array('getFieldInfoCache'), array(), '', false);
     $subject->conf = $configuration;
     // Disable caching
     $mockCacheFrontend = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class, array(), array(), '', false);
     $subject->expects($this->any())->method('getFieldInfoCache')->will($this->returnValue($mockCacheFrontend));
     // Inject SqlParser - Its logic is tested with the tests, too.
     $sqlParser = $this->getAccessibleMock(\TYPO3\CMS\Dbal\Database\SqlParser::class, array('dummy'), array(), '', false);
     $sqlParser->_set('databaseConnection', $subject);
     $sqlParser->_set('sqlCompiler', GeneralUtility::makeInstance(\TYPO3\CMS\Dbal\Database\SqlCompilers\Adodb::class, $subject));
     $sqlParser->_set('nativeSqlCompiler', GeneralUtility::makeInstance(\TYPO3\CMS\Dbal\Database\SqlCompilers\Mysql::class, $subject));
     $subject->SQLparser = $sqlParser;
     // Mock away schema migration service from install tool
     $installerSqlMock = $this->getMock(\TYPO3\CMS\Install\Service\SqlSchemaMigrationService::class, array('getFieldDefinitions_fileContent'), array(), '', false);
     $installerSqlMock->expects($this->any())->method('getFieldDefinitions_fileContent')->will($this->returnValue(array()));
     $subject->_set('installerSql', $installerSqlMock);
     $subject->initialize();
     // Fake a working connection
     $handlerKey = '_DEFAULT';
     $subject->lastHandlerKey = $handlerKey;
     $adodbDriverClass = '\\ADODB_' . $driver;
     $subject->handlerInstance[$handlerKey] = new $adodbDriverClass();
     $subject->handlerInstance[$handlerKey]->DataDictionary = NewDataDictionary($subject->handlerInstance[$handlerKey]);
     $subject->handlerInstance[$handlerKey]->_connectionID = rand(1, 1000);
     return $subject;
 }
示例#6
0
 /**
  * Returns all interceptors for a given Interception Point.
  *
  * @param int $interceptionPoint one of the \TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_* constants,
  * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface>
  */
 public function getInterceptors($interceptionPoint)
 {
     if (isset($this->interceptors[$interceptionPoint]) && $this->interceptors[$interceptionPoint] instanceof \TYPO3\CMS\Extbase\Persistence\ObjectStorage) {
         return $this->interceptors[$interceptionPoint];
     }
     return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class);
 }
示例#7
0
 /**
  * Returns an URL that switches the sorting indicator according to the
  * given sorting direction
  *
  * @param array $arguments Expects 'asc' or 'desc' as sorting direction in key 0
  * @return string
  * @throws \InvalidArgumentException when providing an invalid sorting direction
  */
 public function execute(array $arguments = array())
 {
     $content = '';
     $sortDirection = trim($arguments[0]);
     $configuration = Util::getSolrConfiguration();
     $contentObject = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     $defaultImagePrefix = 'EXT:solr/Resources/Public/Images/Indicator';
     $sortViewHelperConfiguration = $configuration->getViewHelpersSortIndicatorConfiguration();
     switch ($sortDirection) {
         case 'asc':
             $imageConfiguration = $sortViewHelperConfiguration['up.'];
             if (!isset($imageConfiguration['file'])) {
                 $imageConfiguration['file'] = $defaultImagePrefix . 'Up.png';
             }
             $content = $contentObject->cObjGetSingle('IMAGE', $imageConfiguration);
             break;
         case 'desc':
             $imageConfiguration = $sortViewHelperConfiguration['down.'];
             if (!isset($imageConfiguration['file'])) {
                 $imageConfiguration['file'] = $defaultImagePrefix . 'Down.png';
             }
             $content = $contentObject->cObjGetSingle('IMAGE', $imageConfiguration);
             break;
         case '###SORT.CURRENT_DIRECTION###':
         case '':
             // ignore
             break;
         default:
             throw new \InvalidArgumentException('Invalid sorting direction "' . $arguments[0] . '", must be "asc" or "desc".', 1390868460);
     }
     return $content;
 }
 public function flash($message, $severity = \TYPO3\CMS\Core\Messaging\FlashMessage::OK)
 {
     $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, $message, '', $severity, true);
     $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
     $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
     $defaultFlashMessageQueue->enqueue($flashMessage);
 }
 public function setUp()
 {
     $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], 0);
     $GLOBALS['TSFE']->sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
     $this->view = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_gridelements_view');
     $this->view->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
 }
 public function dispatchControllerAction($requestArguments)
 {
     $result = [];
     $extensionName = true === isset($requestArguments['mvc']['extensionName']) ? $requestArguments['mvc']['extensionName'] : null;
     $controllerName = true === isset($requestArguments['mvc']['controller']) ? $requestArguments['mvc']['controller'] : null;
     $vendorName = true === isset($requestArguments['mvc']['vendor']) ? $requestArguments['mvc']['vendor'] : null;
     $actionName = true === isset($requestArguments['mvc']['action']) ? $requestArguments['mvc']['action'] : null;
     $arguments = true === isset($requestArguments['arguments']) ? $requestArguments['arguments'] : [];
     if ($extensionName && $vendorName && $controllerName && $actionName) {
         /** @var Request $request */
         $request = GeneralUtility::makeInstance(Request::class);
         $request->setControllerExtensionName($extensionName);
         $request->setControllerVendorName($vendorName);
         $request->setControllerName($controllerName);
         $request->setControllerActionName($actionName);
         $request->setArguments($arguments);
         /** @var Response $response */
         $response = GeneralUtility::makeInstance(Response::class);
         /** @var Dispatcher $dispatcher */
         $dispatcher = GeneralUtility::makeInstance(Dispatcher::class);
         $dispatcher->dispatch($request, $response);
         $result = $response->getContent();
     }
     return $result;
 }
示例#11
0
 /**
  * Create a rule object according to class
  * and sent some arguments
  *
  * @param string $class Name of the validation rule
  * @param array $arguments Configuration of the rule
  * @return AbstractValidator The rule object
  */
 public function createRule($class, $arguments = array())
 {
     $class = strtolower((string) $class);
     $className = 'TYPO3\\CMS\\Form\\Validation\\' . ucfirst($class) . 'Validator';
     $rule = GeneralUtility::makeInstance($className, $arguments);
     return $rule;
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
     $this->injectConfigurationService($this->objectManager->get(ConfigurationService::class));
     $this->injectPageService($this->objectManager->get(PageService::class));
     $this->injectWorkspacesAwareRecordService($this->objectManager->get(WorkspacesAwareRecordService::class));
 }
示例#13
0
 /**
  * Get tables for menu example
  *
  * @param int $startUid UID from selected page
  * @param int $depth How many levels recursive
  * @return string The tables to be displayed
  */
 public function getTables($startUid, $depth = 0)
 {
     $deletedRecordsTotal = 0;
     $lang = $this->getLanguageService();
     $tables = array();
     foreach (RecyclerUtility::getModifyableTables() as $tableName) {
         $deletedField = RecyclerUtility::getDeletedField($tableName);
         if ($deletedField) {
             // Determine whether the table has deleted records:
             $deletedCount = $this->getDatabaseConnection()->exec_SELECTcountRows('uid', $tableName, $deletedField . '<>0');
             if ($deletedCount) {
                 /* @var $deletedDataObject \TYPO3\CMS\Recycler\Domain\Model\DeletedRecords */
                 $deletedDataObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Recycler\Domain\Model\DeletedRecords::class);
                 $deletedData = $deletedDataObject->loadData($startUid, $tableName, $depth)->getDeletedRows();
                 if (isset($deletedData[$tableName])) {
                     if ($deletedRecordsInTable = count($deletedData[$tableName])) {
                         $deletedRecordsTotal += $deletedRecordsInTable;
                         $tables[] = array($tableName, $deletedRecordsInTable, RecyclerUtility::getUtf8String($lang->sL($GLOBALS['TCA'][$tableName]['ctrl']['title'])));
                     }
                 }
             }
         }
     }
     $jsonArray = $tables;
     array_unshift($jsonArray, array('', $deletedRecordsTotal, $lang->sL('LLL:EXT:recycler/mod1/locallang.xlf:label_allrecordtypes')));
     return $jsonArray;
 }
 public function setUp()
 {
     parent::setUp();
     $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->categoryRepository = $this->objectManager->get('Tx_News_Domain_Repository_NewsRepository');
     $this->importDataSet(__DIR__ . '/../Fixtures/tx_news_domain_model_category.xml');
 }
 /**
  * CONSTRUCTOR
  */
 public function __construct()
 {
     $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->configurationManager = $objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\BackendConfigurationManager');
     $this->configurationService = $objectManager->get('FluidTYPO3\\Fluidpages\\Service\\ConfigurationService');
     $this->pageService = $objectManager->get('FluidTYPO3\\Fluidpages\\Service\\PageService');
 }
示例#16
0
 /**
  * Constructor.
  *
  * @param \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper $viewHelper The view helper
  * @param array $arguments Arguments of view helper - each value is a RootNode.
  */
 public function __construct(\TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper $viewHelper, array $arguments)
 {
     $this->uninitializedViewHelper = $viewHelper;
     $this->viewHelpersByContext = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class);
     $this->arguments = $arguments;
     $this->viewHelperClassName = get_class($this->uninitializedViewHelper);
 }
示例#17
0
 /**
  * Returns the given amount as a formatted string according to the
  * given currency.
  * IMPORTANT NOTE:
  * The amount must always be the smallest unit passed as a string
  * or int! It is a very bad idea to use float for monetary
  * calculations if you need exact values, therefore
  * this method won't accept float values.
  * Examples:
  *      format (500, 'EUR');      --> '5,00 EUR'
  *      format (4.23, 'EUR');     --> FALSE
  *      format ('872331', 'EUR'); --> '8.723,31 EUR'.
  *
  * @param int|string $amount Amount to be formatted. Must be the smalles unit
  * @param string $currencyKey ISO 3 letter code of the currency
  * @param bool $withSymbol If set the currency symbol will be rendered
  *
  * @return string|bool String representation of the amount including currency
  *      symbol(s) or FALSE if $amount was of the type float
  */
 public static function format($amount, $currencyKey, $withSymbol = true)
 {
     if (is_float($amount)) {
         return false;
     }
     /**
      * Currency repository.
      *
      * @var CurrencyRepository
      */
     $currencyRepository = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Repository\\CurrencyRepository');
     $currency = $currencyRepository->findByIso3($currencyKey);
     if (empty($currency)) {
         return false;
     }
     $formattedAmount = number_format($amount / $currency['cu_sub_divisor'], $currency['cu_decimal_digits'], $currency['cu_decimal_point'], $currency['cu_thousands_point']);
     if ($withSymbol) {
         $wholeString = $formattedAmount;
         if (!empty($currency['cu_symbol_left'])) {
             $wholeString = $currency['cu_symbol_left'] . ' ' . $wholeString;
         }
         if (!empty($currency['cu_symbol_right'])) {
             $wholeString .= ' ' . $currency['cu_symbol_right'];
         }
     } else {
         $wholeString = $formattedAmount;
     }
     return $wholeString;
 }
 /**
  * Echoes an exception for the web.
  *
  * @param \Exception $exception The exception
  * @return void
  */
 public function echoExceptionWeb(\Exception $exception)
 {
     $this->sendStatusHeaders($exception);
     $this->writeLogEntries($exception, self::CONTEXT_WEB);
     $messageObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\ErrorpageMessage', $this->getMessage($exception), $this->getTitle($exception));
     $messageObj->output();
 }
示例#19
0
 /**
  * Constructor.
  *
  */
 public function __construct(array $arguments = array())
 {
     if (is_null($this->search)) {
         $this->search = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Solr_Search');
         $this->maxScore = $this->search->getMaximumResultScore();
     }
 }
 /**
  * Reads the [extDir]/locallang.xml and returns the \$LOCAL_LANG array found in that file.
  *
  * @return	The array with language labels
  */
 function includeLocalLang()
 {
     $llFile = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('ke_search') . 'pi2/locallang.xml';
     $xmlParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Parser\\LocallangXmlParser');
     $LOCAL_LANG = $xmlParser->getParsedData($llFile, $GLOBALS['LANG']->lang);
     return $LOCAL_LANG;
 }
 /**
  * Gets the charset conversion object.
  *
  * @return CharsetConverter
  */
 protected function getCharsetConversion()
 {
     if (!isset($this->charsetConversion)) {
         $this->charsetConversion = GeneralUtility::makeInstance(CharsetConverter::class);
     }
     return $this->charsetConversion;
 }
 /**
  * Initialize the live search
  */
 public function __construct()
 {
     // @todo Use the autoloader for this. Not sure why its not working.
     require_once PATH_t3lib . 'search/class.t3lib_search_livesearch_queryParser.php';
     $this->liveSearch = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Search\\LiveSearch\\LiveSearch');
     $this->queryParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Search\\LiveSearch\\QueryParser');
 }
 public function __construct()
 {
     $this->tx_mmforum_postparser = GeneralUtility::makeInstance('tx_mmforum_postparser');
     $this->tx_mmforum_postqueue = GeneralUtility::makeInstance('tx_mmforum_postqueue');
     $this->pi_loadLL();
     parent::__construct();
 }
 protected function renderTypoLink($linkData)
 {
     $cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     /** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $cObj */
     $configuration = array('parameter' => $linkData, 'returnLast' => true);
     return $cObj->typolink('', $configuration);
 }
示例#25
0
 /**
  * Creates a new public/private key pair using PHP OpenSSL extension.
  *
  * @return \TYPO3\CMS\Rsaauth\Keypair A new key pair or NULL in case of error
  * @see tx_rsaauth_abstract_backend::createNewKeyPair()
  */
 public function createNewKeyPair()
 {
     $result = NULL;
     $privateKey = @openssl_pkey_new();
     if ($privateKey) {
         // Create private key as string
         $privateKeyStr = '';
         openssl_pkey_export($privateKey, $privateKeyStr);
         // Prepare public key information
         $exportedData = '';
         $csr = openssl_csr_new(array(), $privateKey);
         openssl_csr_export($csr, $exportedData, FALSE);
         // Get public key (in fact modulus) and exponent
         $publicKey = $this->extractPublicKeyModulus($exportedData);
         $exponent = $this->extractExponent($exportedData);
         // Create result object
         $result = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Rsaauth\\Keypair');
         /** @var $result \TYPO3\CMS\Rsaauth\Keypair */
         $result->setExponent($exponent);
         $result->setPrivateKey($privateKeyStr);
         $result->setPublicKey($publicKey);
         // Clean up all resources
         openssl_free_key($privateKey);
     }
     return $result;
 }
示例#26
0
 /**
  * Constructor
  */
 public function __construct(\TYPO3\CMS\Core\Mail\MailMessage $mailMessage, array $typoScript)
 {
     $this->localCobj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
     $this->localizationHandler = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Form\Localization::class);
     $this->mailMessage = $mailMessage;
     $this->typoScript = $typoScript;
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $GLOBALS['SOBE'] = $this;
     $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
     $this->init();
 }
 /**
  * test process datamap post process field array
  *
  * @test
  */
 public function processDatamapPostProcessFieldArray()
 {
     $hook = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('GridElementsTeam\\Gridelements\\Hooks\\DataHandler');
     $status = '';
     $table = 'tt_content';
     $id = 12;
     $fieldArray = array();
     $map = array(array('tt_content', 0, NULL, 'noPid'), array('tt_content', 0, 23, 123));
     $parentObj = $this->getMock('TYPO3\\CMS\\Core\\DataHandling\\DataHandler', array('getSortNumber'));
     $parentObj->isImporting = FALSE;
     $parentObj->expects($this->any())->method('getSortNumber')->will($this->returnValueMap($map));
     $hook->processDatamap_postProcessFieldArray($status, $table, $id, $fieldArray, $parentObj);
     $this->assertEquals(array(), $fieldArray);
     $_GET['cmd'] = array('tt_content' => array(12 => array('copy' => '23x24')));
     $status = 'new';
     $expectedFieldArray['sorting'] = 123;
     $hook->processDatamap_postProcessFieldArray($status, $table, $id, $fieldArray, $parentObj);
     $this->assertEquals($expectedFieldArray, $fieldArray);
     $_GET['cmd'] = array('tt_content' => array(12 => array('copy' => '-2x24')));
     $t3lib_db = $this->getMock('t3lib_db', array('exec_SELECTgetSingleRow'));
     $t3lib_db->expects($this->once())->method('exec_SELECTgetSingleRow')->will($this->returnValue(array('pid' => 0)));
     $GLOBALS['TYPO3_DB'] = $t3lib_db;
     $expectedFieldArray['sorting'] = null;
     $hook->processDatamap_postProcessFieldArray($status, $table, $id, $fieldArray, $parentObj);
     $this->assertEquals($expectedFieldArray, $fieldArray);
     $t3lib_db = $this->getMock('t3lib_db', array('exec_SELECTgetSingleRow'));
     $t3lib_db->expects($this->once())->method('exec_SELECTgetSingleRow')->will($this->returnValue(array('pid' => 23)));
     $GLOBALS['TYPO3_DB'] = $t3lib_db;
     $expectedFieldArray['sorting'] = '123';
     $hook->processDatamap_postProcessFieldArray($status, $table, $id, $fieldArray, $parentObj);
     $this->assertEquals($expectedFieldArray, $fieldArray);
 }
    /**
     * This method is called by the Scheduler task that triggers
     * the autopublication process
     * It searches for workspaces whose publication date is in the past
     * and publishes them
     *
     * @return void
     */
    public function autoPublishWorkspaces()
    {
        // Temporarily set admin rights
        // @todo once workspaces are cleaned up a better solution should be implemented
        $currentAdminStatus = $GLOBALS['BE_USER']->user['admin'];
        $GLOBALS['BE_USER']->user['admin'] = 1;
        // Select all workspaces that needs to be published / unpublished:
        $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,swap_modes,publish_time,unpublish_time', 'sys_workspace', 'pid=0
				AND
				((publish_time!=0 AND publish_time<=' . (int) $GLOBALS['EXEC_TIME'] . ')
				OR (publish_time=0 AND unpublish_time!=0 AND unpublish_time<=' . (int) $GLOBALS['EXEC_TIME'] . '))' . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_workspace'));
        $workspaceService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\WorkspaceService::class);
        foreach ($workspaces as $rec) {
            // First, clear start/end time so it doesn't get select once again:
            $fieldArray = $rec['publish_time'] != 0 ? array('publish_time' => 0) : array('unpublish_time' => 0);
            $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_workspace', 'uid=' . (int) $rec['uid'], $fieldArray);
            // Get CMD array:
            $cmd = $workspaceService->getCmdArrayForPublishWS($rec['uid'], $rec['swap_modes'] == 1);
            // $rec['swap_modes']==1 means that auto-publishing will swap versions, not just publish and empty the workspace.
            // Execute CMD array:
            $tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
            $tce->stripslashes_values = 0;
            $tce->start(array(), $cmd);
            $tce->process_cmdmap();
        }
        // Restore admin status
        $GLOBALS['BE_USER']->user['admin'] = $currentAdminStatus;
    }
 /**
  * Get Avatar fileUid
  *
  * @param int $beUserId
  * @return int
  */
 protected function getAvatarFileUid($beUserId)
 {
     /** @var QueryBuilder $queryBuilder */
     $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_file_reference');
     $file = $queryBuilder->select('uid_local')->from('sys_file_reference')->where($queryBuilder->expr()->eq('tablenames', $queryBuilder->createNamedParameter('be_users')))->andWhere($queryBuilder->expr()->eq('fieldname', $queryBuilder->createNamedParameter('avatar')))->andWhere($queryBuilder->expr()->eq('table_local', $queryBuilder->createNamedParameter('sys_file')))->andWhere($queryBuilder->expr()->eq('uid_foreign', (int) $beUserId))->execute()->fetchColumn();
     return (int) $file;
 }