/**
  * Do the language pack update
  *
  * @param string $extensionKey: extension key of the language pack
  * @return void
  */
 public function doUpdate($extensionKey)
 {
     $extPath = ExtensionManagementUtility::extPath($extensionKey);
     $fileContent = explode(LF, GeneralUtility::getUrl($extPath . 'ext_tables_static+adt.sql'));
     // SQL parser was moved from core to dbal in TYPO3 CMS 7.5
     if (is_object($GLOBALS['TYPO3_DB']->SQLparser)) {
         $sqlParser = $GLOBALS['TYPO3_DB']->SQLparser;
     } else {
         $sqlParser = $this->objectManager->get('SJBR\\StaticInfoTables\\Database\\SqlParser');
     }
     foreach ($fileContent as $line) {
         $line = trim($line);
         if ($line && preg_match('#^UPDATE#i', $line)) {
             $parsedResult = $sqlParser->parseSQL($line);
             // WHERE clause
             $whereClause = $sqlParser->compileWhereClause($parsedResult['WHERE']);
             // Fields
             $fields = array();
             foreach ($parsedResult['FIELDS'] as $fN => $fV) {
                 $fields[$fN] = $fV[0];
             }
             $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery($parsedResult['TABLE'], $whereClause, $fields, TRUE);
         }
     }
 }
Example #2
0
 /**
  * CONSTRUCTOR
  */
 public function __construct()
 {
     $this->injectObjectManager(GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'));
     $this->injectConfigurationService($this->objectManager->get('FluidTYPO3\\Flux\\Service\\FluxService'));
     $this->injectRecordService($this->objectManager->get('FluidTYPO3\\Flux\\Service\\WorkspacesAwareRecordService'));
     $this->cache = $this->objectManager->get('TYPO3\\CMS\\Core\\Cache\\CacheManager', $this->objectManager)->getCache('flux');
 }
 /**
  * Converts HTML-array to an object
  * @param array $attachments
  * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
  */
 public function initAttachments(array $attachments)
 {
     /* @var \Mittwald\Typo3Forum\Domain\Model\Forum\Attachment */
     $objAttachments = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
     foreach ($attachments as $attachmentID => $attachment) {
         if ($attachment['name'] == '') {
             continue;
         }
         $attachmentObj = $this->objectManager->get('Mittwald\\Typo3Forum\\Domain\\Model\\Forum\\Attachment');
         $tmp_name = $_FILES['tx_typo3forum_pi1']['tmp_name']['attachments'][$attachmentID];
         $mime_type = mime_content_type($tmp_name);
         //Save in ObjectStorage and in file system
         $attachmentObj->setFilename($attachment['name']);
         $attachmentObj->setRealFilename(sha1($attachment['name'] . time()));
         $attachmentObj->setMimeType($mime_type);
         //Create dir if not exists
         $tca = $attachmentObj->getTCAConfig();
         $path = $tca['columns']['real_filename']['config']['uploadfolder'];
         if (!file_exists($path)) {
             mkdir($path, '0777', true);
         }
         //upload file and put in object storage
         $res = \TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move($tmp_name, $attachmentObj->getAbsoluteFilename());
         if ($res === true) {
             $objAttachments->attach($attachmentObj);
         }
     }
     return $objAttachments;
 }
Example #4
0
 /**
  * Get postRepository
  *
  * @return \TYPO3\T3extblog\Domain\Repository\PostRepository
  */
 protected function getPostRepository()
 {
     if ($this->postRepository === NULL) {
         $this->postRepository = $this->objectManager->get('TYPO3\\T3extblog\\Domain\\Repository\\PostRepository');
     }
     return $this->postRepository;
 }
Example #5
0
	/**
	 * Processes the list of actions for a given extension and adds
	 * a link to the manual(s), if available.
	 *
	 * @param array $extension
	 * @param array $actions
	 * @return void
	 */
	public function processActions(array $extension, array &$actions) {
		if (static::$documents === NULL) {
			/** @var \TYPO3\CMS\Documentation\Controller\DocumentController $documentController */
			$documentController = $this->objectManager->get(\TYPO3\CMS\Documentation\Controller\DocumentController::class);
			static::$documents = $documentController->getDocuments();
		}

		$extensionKey = $extension['key'];
		$documentKey = 'typo3cms.extensions.' . $extensionKey;

		if (isset(static::$documents[$documentKey])) {
			$document = static::$documents[$documentKey];

			foreach ($document->getTranslations() as $documentTranslation) {
				$actions[] = FormatsViewHelper::renderStatic(
					array(
						'documentTranslation' => $documentTranslation,
					),
					function() {},
					new RenderingContext()
				);
			}
		} else {
			$actions[] = '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>';
			$actions[] = '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>';
			$actions[] = '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>';
		}
	}
 /**
  * Constructor
  */
 public function __construct()
 {
     $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->injectObjectManager($objectManager);
     $configurationService = $this->objectManager->get('FluidTYPO3\\Flux\\Service\\FluxService');
     $this->injectConfigurationService($configurationService);
 }
 /**
  * User function
  *
  * @return string
  */
 public function userFunc()
 {
     $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
     $this->injectDocCommentParser($this->objectManager->get(\TYPO3\CMS\Extbase\Reflection\DocCommentParser::class));
     $this->injectReflectionService($this->objectManager->get(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class));
     return $this->generateDocbook(\TYPO3\CMS\Fluid\ViewHelpers::class);
 }
Example #8
0
 /**
  * Returns an instance of pager for a given configuration builder and a pager configuration
  *
  * @param Tx_PtExtlist_Domain_Configuration_Pager_PagerConfig $pagerConfiguration
  * @return Tx_PtExtlist_Domain_Model_Pager_PagerInterface
  */
 public function getInstance(Tx_PtExtlist_Domain_Configuration_Pager_PagerConfig $pagerConfiguration)
 {
     $pagerClassName = $pagerConfiguration->getPagerClassName();
     $pager = $this->objectManager->get($pagerClassName, $pagerConfiguration);
     Tx_PtExtbase_Assertions_Assert::isTrue(is_a($pager, 'Tx_PtExtlist_Domain_Model_Pager_PagerInterface'), array('message' => 'Given pager class does not implement pager interface! 1279541488'));
     return $pager;
 }
 /**
  * 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));
 }
Example #10
0
 /**
  * Converts string of tags to an object
  * @param string $tags
  * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
  */
 public function initTags($tags)
 {
     /* @var \Mittwald\Typo3Forum\Domain\Model\Forum\Tag */
     $objTags = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
     $tagArray = array_unique(explode(',', $tags));
     foreach ($tagArray as $tagName) {
         $tagName = ucfirst(trim($tagName));
         if ($tagName == "") {
             continue;
         }
         $searchResult = $this->tagRepository->findTagWithSpecificName($tagName);
         if ($searchResult[0] != false) {
             $searchResult[0]->increaseTopicCount();
             $objTags->attach($searchResult[0]);
         } else {
             /* @var \Mittwald\Typo3Forum\Domain\Model\Forum\Tag $tag */
             $tag = $this->objectManager->get('Mittwald\\Typo3Forum\\Domain\\Model\\Forum\\Tag');
             $tag->setName($tagName);
             $tag->setCrdate(new \DateTime());
             $tag->increaseTopicCount();
             $objTags->attach($tag);
         }
     }
     return $objTags;
 }
 protected function initializeEnvironment()
 {
     /**
      * @var ConfigurationManager $configurationManager
      * @var ContentObjectRenderer $contentObjectRenderer
      */
     $this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
     $this->configurationManager =& $configurationManager;
     $contentObjectRenderer = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     $this->configurationManager->setContentObject($contentObjectRenderer);
     $this->uriBuilder = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder');
     if (empty($GLOBALS['TSFE']->sys_page)) {
         $GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
     }
     if (empty($GLOBALS['TSFE']->tmpl)) {
         $GLOBALS['TSFE']->initTemplate();
     }
     if (!isset($GLOBALS['TSFE']->config)) {
         $GLOBALS['TSFE']->config = array();
     }
     if (empty($GLOBALS['TSFE']->config['config'])) {
         $GLOBALS['TSFE']->config['config'] = array();
         $GLOBALS['TSFE']->config['config']['tx_realurl_enable'] = TRUE;
         $GLOBALS['TSFE']->config['mainScript'] = 'index.php';
     }
 }
Example #12
0
 /**
  * The main method called by the controller
  *
  * @param array $field
  * @param integer $form
  * @param object $mail
  * @param Tx_Powermail_Controller_FormsController $pObj
  *
  * @return string
  */
 public function process($field, $form, $mail, $pObj)
 {
     $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $data = array();
     return '';
     // TODO create fe_user
     // TODO check if user exists, but not here, new signal slot?
     // Check Lookups
     // Use sp_powermail signal finisher
     if (is_array($field) && count($field) > 0) {
         foreach ($field as $uid => $value) {
             if (is_numeric($uid)) {
                 $fieldsRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Powermail_Domain_Repository_FieldsRepository');
                 $row = $fieldsRepository->findByUid($uid);
                 if ('sharepoint' == $row->getType()) {
                     $mappingAttributeRepository = $this->objectManager->get('Aijko\\SharepointConnector\\Domain\\Repository\\Mapping\\AttributeRepository');
                     $sharepointAttribute = $mappingAttributeRepository->findByUid($row->getSharepointAttribute());
                     $data[$row->getSharepointList()][$sharepointAttribute->getTypo3FieldName()] = $value;
                 }
             }
         }
         // Store data
         $sharepointListsRepository = $this->objectManager->get('Aijko\\SharepointConnector\\Domain\\Repository\\Sharepoint\\ListsRepository');
         $result = $sharepointListsRepository->addToMultipleLists($data);
         if (!$result) {
             // TODO error handling
             // result = array with sharepoint result
         }
     }
 }
Example #13
0
 /**
  * Creates a ResolverHandler by given $name
  *
  * @param string $handlerName Name of the resolver handler to create
  * @param ResolverHandlerInterface $nextHandler Next handler for the resolver
  *
  * @return ResolverHandlerInterface
  */
 public function create($handlerName, ResolverHandlerInterface $nextHandler = null)
 {
     if (is_null($nextHandler)) {
         return $this->objectManager->get($handlerName);
     }
     return $this->objectManager->get($handlerName, $nextHandler);
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->configurationService = $this->objectManager->get('FluidTYPO3\\Fluidpages\\Service\\ConfigurationService');
     $this->pageService = $this->objectManager->get('FluidTYPO3\\Fluidpages\\Service\\PageService');
     $this->recordService = $this->objectManager->get('FluidTYPO3\\Flux\\Service\\WorkspacesAwareRecordService');
 }
 /**
  * User function
  *
  * @return string
  */
 public function userFunc()
 {
     $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->injectDocCommentParser($this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\DocCommentParser'));
     $this->injectReflectionService($this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService'));
     return $this->generateDocbook('TYPO3\\CMS\\Fluid\\ViewHelpers');
 }
Example #16
0
 /**
  * Builds a CLI request object from a command line.
  *
  * The given command line may be a string (e.g. "myextension:foo do-that-thing --force") or
  * an array consisting of the individual parts. The array must not include the script
  * name (like in $argv) but start with command right away.
  *
  * @param mixed $commandLine The command line, either as a string or as an array
  * @param string $callingScript The calling script (usually ./typo3/cli_dispatch.phpsh)
  * @return \TYPO3\CMS\Extbase\Mvc\Cli\Request The CLI request as an object
  */
 public function build($commandLine = '', $callingScript = './typo3/cli_dispatch.phpsh extbase')
 {
     $request = $this->objectManager->get(\TYPO3\CMS\Extbase\Mvc\Cli\Request::class);
     $request->setCallingScript($callingScript);
     $request->setControllerObjectName(\TYPO3\CMS\Extbase\Command\HelpCommandController::class);
     $rawCommandLineArguments = is_array($commandLine) ? $commandLine : explode(' ', $commandLine);
     if (empty($rawCommandLineArguments)) {
         $request->setControllerCommandName('helpStub');
         return $request;
     }
     $commandIdentifier = trim(array_shift($rawCommandLineArguments));
     try {
         $command = $this->commandManager->getCommandByIdentifier($commandIdentifier);
         $this->configurationManager->setConfiguration(array('extensionName' => $command->getExtensionName()));
     } catch (\TYPO3\CMS\Extbase\Mvc\Exception\CommandException $exception) {
         $request->setArgument('exception', $exception);
         $request->setControllerCommandName('error');
         return $request;
     }
     $controllerObjectName = $command->getControllerClassName();
     $controllerCommandName = $command->getControllerCommandName();
     $request->setControllerObjectName($controllerObjectName);
     $request->setControllerCommandName($controllerCommandName);
     list($commandLineArguments, $exceedingCommandLineArguments) = $this->parseRawCommandLineArguments($rawCommandLineArguments, $controllerObjectName, $controllerCommandName);
     $request->setArguments($commandLineArguments);
     $request->setExceedingArguments($exceedingCommandLineArguments);
     return $request;
 }
 /**
  * @param Address $address
  * @return bool
  */
 protected function isValid($address)
 {
     $result = true;
     $settings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, 'H2dmailsub', 'Pidmailsubscribe');
     $validationSettings = $settings['validation'];
     foreach ($validationSettings as $field => $validations) {
         $value = $address->{'get' . ucfirst($field)}();
         foreach ($validations as $validation => $validationSetting) {
             switch ($validation) {
                 case 'required':
                     if ($validationSetting === '1' && empty($value)) {
                         $error = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Validation\\Error', \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('validation.required', 'h2dmailsub'), time());
                         $this->result->forProperty($field)->addError($error);
                         $result = false;
                     }
                     break;
                 case 'email':
                     if (!empty($value) && $validationSetting === '1' && !\TYPO3\CMS\Core\Utility\GeneralUtility::validEmail($value)) {
                         $error = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Validation\\Error', \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('validation.email', 'h2dmailsub'), time());
                         $this->result->forProperty($field)->addError($error);
                         $result = false;
                     }
                     break;
             }
         }
     }
     return $result;
 }
Example #18
0
 /**
  * CONSTRUCTOR
  */
 public function __construct()
 {
     $this->injectObjectManager(GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'));
     $this->injectConfigurationService($this->objectManager->get('FluidTYPO3\\Flux\\Service\\FluxService'));
     $this->injectRecordService($this->objectManager->get('FluidTYPO3\\Flux\\Service\\RecordService'));
     $this->injectContentService($this->objectManager->get('FluidTYPO3\\Flux\\Service\\ContentService'));
 }
Example #19
0
 /**
  * Process content object data
  *
  * @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)
 {
     $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
     $this->factory = $this->objectManager->get(Typo3PagesFactory::class);
     $processedData['currentPage'] = $this->factory->createFromAssociativeArray($cObj->data);
     return $processedData;
 }
Example #20
0
 /**
  * @param array $_params
  * @param \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication $pObj
  */
 public function postProcessing($_params, $pObj)
 {
     $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     /** @var \Portrino\PxHybridAuth\Utility\SingleSignOnUtility $singleSignOnUtility */
     $singleSignOnUtility = $this->objectManager->get('Portrino\\PxHybridAuth\\Utility\\SingleSignOnUtility');
     $singleSignOnUtility->logout();
     $pObj->removeCookie('PHPSESSID');
 }
Example #21
0
 /**
  * @param string $extensionName The condensed upper camel case extension key
  * @param string $pluginName
  * @return void
  */
 public function boot($extensionName, $pluginName = 'dummy')
 {
     $configuration['extensionName'] = $extensionName;
     $configuration['pluginName'] = $pluginName;
     $extbaseBootstrap = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Core\\Bootstrap');
     /** @var \TYPO3\CMS\Extbase\Core\Bootstrap $extbaseBootstrap  */
     $extbaseBootstrap->initialize($configuration);
 }
Example #22
0
 /**
  * @param TypeConverterInterface|string $typeConverter
  * @return TypeConverterPipe
  */
 public function setTypeConverter($typeConverter)
 {
     if (TRUE === is_string($typeConverter)) {
         $typeConverter = $this->objectManager->get($typeConverter);
     }
     $this->typeConverter = $typeConverter;
     return $this;
 }
 /**
  * @return void
  */
 protected function initializeConcreteConfigurationManager()
 {
     if ($this->environmentService->isEnvironmentInFrontendMode()) {
         $this->concreteConfigurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\FrontendConfigurationManager');
     } else {
         $this->concreteConfigurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\BackendConfigurationManager');
     }
 }
Example #24
0
 /**
  * @param array $_params
  * @param \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication $pObj
  */
 public function postProcessing($_params, $pObj)
 {
     $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
     /** @var SingleSignOnUtility $singleSignOnUtility */
     $singleSignOnUtility = $this->objectManager->get(SingleSignOnUtility::class);
     $singleSignOnUtility->logout();
     $pObj->removeCookie('PHPSESSID');
 }
 /**
  * Resolves a concrete resource by topic + action
  *
  * @param string $topic The resource topic, e.g "forums"
  * @param string $action The resource action, e.g. "listPosts"
  *
  * @return AbstractResource
  * @throws UnknownObjectException Is re-thrown if the DIC ObjectManager
  * can not resolve a proper resource object instance.
  */
 public function resolve($topic, $action)
 {
     try {
         return $this->objectManager->get(sprintf($this->patternProvider->getPattern(), $topic, $action));
     } catch (\Exception $e) {
         throw new UnknownObjectException('The resource ' . $topic . '/' . $action . ' is currently not implemented!', 1367666179);
     }
 }
Example #26
0
 /**
  * @return void
  */
 protected function initializeConcreteSessionManager()
 {
     if ($this->environmentService->isEnvironmentInFrontendMode()) {
         $this->concreteSessionManager = $this->objectManager->get('Aijko\\SessionStorage\\FrontendStorage');
     } else {
         $this->concreteSessionManager = $this->objectManager->get('Aijko\\SessionStorage\\BackendStorage');
     }
 }
Example #27
0
 /**
  * Initializes the Object framework.
  *
  * @param array $configuration
  * @return void
  * @see initialize()
  */
 public function initializeConfiguration($configuration)
 {
     $this->configurationManager = $this->objectManager->get(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::class);
     /** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject */
     $contentObject = isset($this->cObj) ? $this->cObj : \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
     $this->configurationManager->setContentObject($contentObject);
     $this->configurationManager->setConfiguration($configuration);
 }
Example #28
0
 /**
  * Parses variables again
  *
  * @param array $variablesMarkers Variables and Markers array
  * @param \In2code\Powermail\Domain\Model\Mail $mail Variables and Labels array
  * @param string $type "web" or "mail"
  * @return string Changed string
  */
 public function render($variablesMarkers = array(), \In2code\Powermail\Domain\Model\Mail $mail, $type = 'web')
 {
     $parseObject = $this->objectManager->get('\\TYPO3\\CMS\\Fluid\\View\\StandaloneView');
     $parseObject->setTemplateSource($this->renderChildren());
     $parseObject->assignMultiple($this->div->htmlspecialcharsOnArray($variablesMarkers));
     $powermailAll = $this->div->powermailAll($mail, $type, $this->settings);
     $parseObject->assign('powermail_all', $powermailAll);
     return html_entity_decode($parseObject->render());
 }
Example #29
0
 /**
  * Send response to browser
  *
  * @param array $data The response data
  * @return void
  */
 protected function sendResponse(array $data)
 {
     $response = $this->objectManager->get(Response::class);
     $response->setHeader('Content-Type', 'application/json; charset=utf-8');
     $response->setContent(json_encode($data));
     $response->sendHeaders();
     $response->send();
     exit;
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     /** @var ObjectManager $objectManager */
     $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->injectObjectManager($objectManager);
     /** @var ConfigurationService $configurationService */
     $configurationService = $this->objectManager->get('FluidTYPO3\\FluidcontentCore\\Service\\ConfigurationService');
     $this->injectConfigurationService($configurationService);
 }