/**
  * Dispatches the given event
  *
  * @param EventInterface $event Event to dispatch
  *
  * @return mixed|array Event arguments will be returned on exception
  */
 public function dispatch(EventInterface $event)
 {
     try {
         return $this->dispatcher->dispatch($this->signalClassName, $event->getLabel(), $event->getArguments());
     } catch (InvalidSlotException $exc) {
         return $event->getArguments();
     } catch (InvalidSlotReturnException $exc) {
         return $event->getArguments();
     }
 }
 /**
  * Check if the SFC should create the cache
  *
  * @param    TypoScriptFrontendController $pObj : The parent object
  * @param    string $timeOutTime : The timestamp when the page times out
  *
  * @return    void
  */
 public function insertPageIncache(TypoScriptFrontendController &$pObj, &$timeOutTime)
 {
     $isStaticCached = false;
     $uri = $this->getUri();
     // Signal: Initialize variables before starting the processing.
     $preProcessArguments = ['frontendController' => $pObj, 'uri' => $uri];
     $preProcessArguments = $this->signalDispatcher->dispatch(__CLASS__, 'preProcess', $preProcessArguments);
     $uri = $preProcessArguments['uri'];
     // cache rules
     $ruleArguments = ['frontendController' => $pObj, 'uri' => $uri, 'explanation' => [], 'skipProcessing' => false];
     $ruleArguments = $this->signalDispatcher->dispatch(__CLASS__, 'cacheRule', $ruleArguments);
     $explanation = $ruleArguments['explanation'];
     if (!$ruleArguments['skipProcessing']) {
         // Don't continue if there is already an existing valid cache entry and we've got an invalid now.
         // Prevents overriding if a logged in user is checking the page in a second call
         // see https://forge.typo3.org/issues/67526
         if (count($explanation) && $this->hasValidCacheEntry($uri)) {
             return;
         }
         // The page tag pageId_NN is included in $pObj->pageCacheTags
         $cacheTags = ObjectAccess::getProperty($pObj, 'pageCacheTags', true);
         $cacheTags[] = 'sfc_pageId_' . $pObj->page['uid'];
         $cacheTags[] = 'sfc_domain_' . str_replace('.', '_', parse_url($uri, PHP_URL_HOST));
         // This is supposed to have "&& !$pObj->beUserLogin" in there as well
         // This fsck's up the ctrl-shift-reload hack, so I pulled it out.
         if (sizeof($explanation) === 0) {
             // If page has a endtime before the current timeOutTime, use it instead:
             if ($pObj->page['endtime'] > 0 && $pObj->page['endtime'] < $timeOutTime) {
                 $timeOutTime = $pObj->page['endtime'];
             }
             $timeOutSeconds = $timeOutTime - $GLOBALS['EXEC_TIME'];
             $content = $pObj->content;
             if ($this->configuration->get('showGenerationSignature')) {
                 $content .= "\n<!-- cached statically on: " . strftime($this->configuration->get('strftime'), $GLOBALS['EXEC_TIME']) . ' -->';
                 $content .= "\n<!-- expires on: " . strftime($this->configuration->get('strftime'), $timeOutTime) . ' -->';
             }
             // Signal: Process content before writing to static cached file
             $processContentArguments = ['frontendController' => $pObj, 'uri' => $uri, 'content' => $content, 'timeOutSeconds' => $timeOutSeconds];
             $processContentArguments = $this->signalDispatcher->dispatch(__CLASS__, 'processContent', $processContentArguments);
             $content = $processContentArguments['content'];
             $timeOutSeconds = $processContentArguments['timeOutSeconds'];
             $uri = $processContentArguments['uri'];
             $isStaticCached = true;
         } else {
             $cacheTags[] = 'explanation';
             $content = $explanation;
             $timeOutSeconds = 0;
         }
         // create cache entry
         $this->cache->set($uri, $content, $cacheTags, $timeOutSeconds);
     }
     // Signal: Post process (no matter whether content was cached statically)
     $postProcessArguments = ['frontendController' => $pObj, 'uri' => $uri, 'isStaticCached' => $isStaticCached];
     $this->signalDispatcher->dispatch(__CLASS__, 'postProcess', $postProcessArguments);
 }
示例#3
0
	/**
	 * Emits a signal after the list of actions is processed
	 *
	 * @param string $extension
	 * @param array $actions
	 * @return array Modified action array
	 */
	protected function emitProcessActionsSignal($extension, array $actions) {
		$this->signalSlotDispatcher->dispatch(
			__CLASS__,
			static::SIGNAL_ProcessActions,
			array(
				$extension,
				&$actions,
			)
		);
		return $actions;
	}
示例#4
0
 /**
  * Emits a signal to manipulate the tables definitions
  *
  * @param array $sqlString
  * @return mixed
  */
 protected function emitTablesDefinitionIsBeingBuiltSignal(array $sqlString)
 {
     $signalReturn = $this->signalSlotDispatcher->dispatch(__CLASS__, 'tablesDefinitionIsBeingBuilt', [$sqlString]);
     // This is important to support old associated returns
     $signalReturn = array_values($signalReturn);
     $sqlString = $signalReturn[0];
     if (!is_array($sqlString)) {
         throw new Exception\UnexpectedSignalReturnValueTypeException(sprintf('The signal %s of class %s returned a value of type %s, but array was expected.', 'tablesDefinitionIsBeingBuilt', __CLASS__, gettype($sqlString)), 1476109357);
     }
     return $sqlString;
 }
 /**
  * Set receiver mails
  *
  * @return void
  */
 public function setReceiverEmails()
 {
     // get mails from FlexForm
     $emailArray = $this->getEmailsFromFlexForm();
     // get mails from fe_group
     if ((int) $this->settings['receiver']['type'] === 1 && !empty($this->settings['receiver']['fe_group'])) {
         $emailArray = $this->getEmailsFromFeGroup($this->settings['receiver']['fe_group']);
     }
     // get mails from predefined emailconfiguration
     if ((int) $this->settings['receiver']['type'] === 2 && !empty($this->settings['receiver']['predefinedemail'])) {
         $emailArray = $this->getEmailsFromPredefinedEmail($this->settings['receiver']['predefinedemail']);
     }
     // get mails from overwrite typoscript settings
     $overwriteReceivers = $this->overWriteEmailsWithTypoScript();
     if (!empty($overwriteReceivers)) {
         $emailArray = $overwriteReceivers;
     }
     // get mail from development context
     if (ConfigurationUtility::getDevelopmentContextEmail()) {
         $emailArray = [ConfigurationUtility::getDevelopmentContextEmail()];
     }
     // overwrite with a signal if needed
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__, [&$emailArray, $this]);
     $this->receiverEmails = $emailArray;
 }
示例#6
0
文件: SendMail.php 项目: advOpk/pwm
 /**
  * Create Email Body
  *
  * @param array $email Array with all needed mail information
  * @param \In2code\Powermail\Domain\Model\Mail $mail
  * @param array $settings TypoScript Settings
  * @return bool
  */
 protected function createEmailBody($email, \In2code\Powermail\Domain\Model\Mail &$mail, $settings)
 {
     $emailBodyObject = $this->objectManager->get('\\TYPO3\\CMS\\Fluid\\View\\StandaloneView');
     $emailBodyObject->getRequest()->setControllerExtensionName('Powermail');
     $emailBodyObject->getRequest()->setPluginName('Pi1');
     $emailBodyObject->getRequest()->setControllerName('Form');
     $emailBodyObject->setFormat('html');
     $templatePathAndFilename = $this->div->getTemplatePath() . $email['template'] . '.html';
     $emailBodyObject->setTemplatePathAndFilename($templatePathAndFilename);
     $emailBodyObject->setLayoutRootPath($this->div->getTemplatePath('layout'));
     $emailBodyObject->setPartialRootPath($this->div->getTemplatePath('partial'));
     // get variables
     // additional variables
     if (isset($email['variables']) && is_array($email['variables'])) {
         $emailBodyObject->assignMultiple($email['variables']);
     }
     // markers in HTML Template
     $variablesWithMarkers = $this->div->getVariablesWithMarkers($mail);
     $emailBodyObject->assign('variablesWithMarkers', $this->div->htmlspecialcharsOnArray($variablesWithMarkers));
     $emailBodyObject->assignMultiple($variablesWithMarkers);
     $emailBodyObject->assignMultiple($this->div->getLabelsAttachedToMarkers($mail));
     $emailBodyObject->assign('powermail_all', $this->div->powermailAll($mail, 'mail', $settings));
     // from rte
     $emailBodyObject->assign('powermail_rte', $email['rteBody']);
     $emailBodyObject->assign('marketingInfos', Div::getMarketingInfos());
     $emailBodyObject->assign('mail', $mail);
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'BeforeRender', array($emailBodyObject, $email, $mail, $settings));
     $body = $emailBodyObject->render();
     $mail->setBody($body);
     return $body;
 }
示例#7
0
 /**
  * @test
  * @expectedException \TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException
  */
 public function dispatchThrowsInvalidSlotExceptionIfObjectManagerOfSignalSlotDispatcherIsNotSet()
 {
     $this->signalSlotDispatcher->_set('isInitialized', true);
     $this->signalSlotDispatcher->_set('objectManager', null);
     $this->signalSlotDispatcher->_set('slots', array('ClassA' => array('emitSomeSignal' => array(array()))));
     $this->assertSame(null, $this->signalSlotDispatcher->dispatch('ClassA', 'emitSomeSignal'));
 }
 /**
  * Some additional actions after profile creation
  *
  * @param User $user
  * @param string $action
  * @param string $redirectByActionName Action to redirect
  * @param bool $login Login after creation
  * @param string $status
  * @return void
  */
 public function finalCreate($user, $action, $redirectByActionName, $login = TRUE, $status = '')
 {
     // persist user (otherwise login is not possible if user is still disabled)
     $this->userRepository->update($user);
     $this->persistenceManager->persistAll();
     // login user
     if ($login) {
         $this->loginAfterCreate($user);
     }
     // send notify email to user
     $this->sendMail->send('createUserNotify', Div::makeEmailArray($user->getEmail(), $user->getFirstName() . ' ' . $user->getLastName()), array($this->settings['new']['email']['createUserNotify']['sender']['email']['value'] => $this->settings['settings']['new']['email']['createUserNotify']['sender']['name']['value']), 'Profile creation', array('user' => $user, 'settings' => $this->settings), $this->config['new.']['email.']['createUserNotify.']);
     // send notify email to admin
     if ($this->settings['new']['notifyAdmin']) {
         $this->sendMail->send('createNotify', Div::makeEmailArray($this->settings['new']['notifyAdmin'], $this->settings['new']['email']['createAdminNotify']['receiver']['name']['value']), Div::makeEmailArray($user->getEmail(), $user->getUsername()), 'Profile creation', array('user' => $user, 'settings' => $this->settings), $this->config['new.']['email.']['createAdminNotify.']);
     }
     // sendpost: send values via POST to any target
     Div::sendPost($user, $this->config, $this->cObj);
     // store in database: store values in any wanted table
     Div::storeInDatabasePreflight($user, $this->config, $this->cObj, $this->objectManager);
     // add signal after user generation
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'AfterPersist', array($user, $action, $this));
     // frontend redirect (if activated via TypoScript)
     $this->redirectByAction($action, $status ? $status . 'Redirect' : 'redirect');
     // go to an action
     $this->redirect($redirectByActionName);
 }
 /**
  * Initialize all actions
  *
  * @see \TYPO3\CMS\Extbase\Mvc\Controller\ActionController::initializeAction()
  * @return void
  */
 protected function initializeAction()
 {
     $this->fileService = $this->objectManager->get(\Evoweb\SfRegister\Services\File::class);
     if ($this->settings['processInitializeActionSignal']) {
         $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__, array('controller' => $this, 'settings' => $this->settings));
     }
     if ($this->request->getControllerActionName() != 'removeImage' && $this->request->hasArgument('removeImage') && $this->request->getArgument('removeImage')) {
         $this->forward('removeImage');
     }
 }
示例#10
0
 /**
  * Create meta data object for given fileName
  *
  * @param string $fileName Path to file
  * @return Tx_Yag_Domain_Model_ItemMeta Meta Data object for file
  */
 public function createItemMetaForFile($fileName)
 {
     $itemMeta = new Tx_Yag_Domain_Model_ItemMeta();
     $this->setDefaults($itemMeta);
     $this->processCoreData($fileName, $itemMeta);
     $this->processExifData($fileName, $itemMeta);
     $this->processIPTCData($fileName, $itemMeta);
     $this->processXMPData($fileName, $itemMeta);
     $this->signalSlotDispatcher->dispatch(__CLASS__, 'processMetaData', array('metaData' => &$itemMeta, 'fileName' => $fileName));
     return $itemMeta;
 }
示例#11
0
 /**
  * Emits a signal to manipulate the tables definitions
  *
  * @param array $sqlString
  * @return array
  * @throws \TYPO3\CMS\Core\Database\Schema\Exception\UnexpectedSignalReturnValueTypeException
  * @throws \TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotReturnException
  * @throws \TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException
  */
 protected function emitTablesDefinitionIsBeingBuiltSignal(array $sqlString) : array
 {
     // Using the old class name from the install tool here to keep backwards compatibility.
     $signalReturn = $this->signalSlotDispatcher->dispatch(SqlExpectedSchemaService::class, 'tablesDefinitionIsBeingBuilt', [$sqlString]);
     // This is important to support old associated returns
     $signalReturn = array_values($signalReturn);
     $sqlString = $signalReturn[0];
     if (!is_array($sqlString)) {
         throw new Exception\UnexpectedSignalReturnValueTypeException(sprintf('The signal %s of class %s returned a value of type %s, but array was expected.', 'tablesDefinitionIsBeingBuilt', __CLASS__, gettype($sqlString)), 1382351456);
     }
     return $sqlString;
 }
 /**
  * Authenticate user
  * @param $user array record
  * @return int One of these values: 100 = Pass, 0 = Failed, 200 = Success
  */
 public function authUser(&$user)
 {
     if (!$user['fromHybrid']) {
         return self::STATUS_AUTHENTICATION_FAILURE_CONTINUE;
     }
     $result = self::STATUS_AUTHENTICATION_FAILURE_CONTINUE;
     if ($user) {
         $result = self::STATUS_AUTHENTICATION_SUCCESS_BREAK;
     }
     //signal slot authUser
     $this->signalSlotDispatcher->dispatch(__CLASS__, 'authUser', array($user, &$result, $this));
     return $result;
 }
示例#13
0
 /**
  * Handles the incoming form data
  *
  * @param Element $element
  * @param array $userConfiguredElementTypoScript
  * @return array
  */
 protected function handleIncomingValues(Element $element, array $userConfiguredElementTypoScript)
 {
     if (!$this->getIncomingData()) {
         return;
     }
     $elementName = $element->getName();
     if ($element->getHtmlAttribute('value') !== null) {
         $modelValue = $element->getHtmlAttribute('value');
     } else {
         $modelValue = $element->getAdditionalArgument('value');
     }
     if ($this->getIncomingData()->getIncomingField($elementName) !== null) {
         /* filter values and set it back to incoming fields */
         /* remove xss every time */
         $userConfiguredElementTypoScript['filters.'][-1] = 'removexss';
         $keys = TemplateService::sortedKeyList($userConfiguredElementTypoScript['filters.']);
         foreach ($keys as $key) {
             $class = $userConfiguredElementTypoScript['filters.'][$key];
             if ((int) $key && strpos($key, '.') === false) {
                 $filterArguments = $userConfiguredElementTypoScript['filters.'][$key . '.'];
                 $filterClassName = $this->typoScriptRepository->getRegisteredClassName((string) $class, 'registeredFilters');
                 if ($filterClassName !== null) {
                     // toDo: handel array values
                     if (is_string($this->getIncomingData()->getIncomingField($elementName))) {
                         if (is_null($filterArguments)) {
                             $filter = $this->objectManager->get($filterClassName);
                         } else {
                             $filter = $this->objectManager->get($filterClassName, $filterArguments);
                         }
                         if ($filter) {
                             $value = $filter->filter($this->getIncomingData()->getIncomingField($elementName));
                             $this->getIncomingData()->setIncomingField($elementName, $value);
                         } else {
                             throw new \RuntimeException('Class "' . $filterClassName . '" could not be loaded.');
                         }
                     }
                 } else {
                     throw new \RuntimeException('Class "' . $filterClassName . '" not registered via TypoScript.');
                 }
             }
         }
         if ($element->getHtmlAttribute('value') !== null) {
             $element->setHtmlAttribute('value', $this->getIncomingData()->getIncomingField($elementName));
         } else {
             $element->setAdditionalArgument('value', $this->getIncomingData()->getIncomingField($elementName));
         }
     }
     $this->signalSlotDispatcher->dispatch(__CLASS__, 'txFormHandleIncomingValues', array($element, $this->getIncomingData(), $modelValue, $this));
 }
 /**
  * Displays teasers
  *
  * @return void
  */
 public function indexAction()
 {
     $this->currentPageUid = $GLOBALS['TSFE']->id;
     $this->performTemplatePathAndFilename();
     $this->setOrderingAndLimitation();
     $this->performPluginConfigurations();
     switch ($this->settings['source']) {
         default:
         case 'thisChildren':
             $rootPageUids = $this->currentPageUid;
             $pages = $this->pageRepository->findByPid($this->currentPageUid);
             break;
         case 'thisChildrenRecursively':
             $rootPageUids = $this->currentPageUid;
             $pages = $this->pageRepository->findByPidRecursively($this->currentPageUid, (int) $this->settings['recursionDepthFrom'], (int) $this->settings['recursionDepth']);
             break;
         case 'custom':
             $rootPageUids = $this->settings['customPages'];
             $pages = $this->pageRepository->findByPidList($this->settings['customPages'], $this->settings['orderByPlugin']);
             break;
         case 'customChildren':
             $rootPageUids = $this->settings['customPages'];
             $pages = $this->pageRepository->findChildrenByPidList($this->settings['customPages']);
             break;
         case 'customChildrenRecursively':
             $rootPageUids = $this->settings['customPages'];
             $pages = $this->pageRepository->findChildrenRecursivelyByPidList($this->settings['customPages'], (int) $this->settings['recursionDepthFrom'], (int) $this->settings['recursionDepth']);
             break;
     }
     if ($this->settings['pageMode'] !== 'nested') {
         $pages = $this->performSpecialOrderings($pages);
     }
     /** @var $page \PwTeaserTeam\PwTeaser\Domain\Model\Page */
     foreach ($pages as $page) {
         if ($page->getUid() === $this->currentPageUid) {
             $page->setIsCurrentPage(TRUE);
         }
         // Load contents if enabled in configuration
         if ($this->settings['loadContents'] == '1') {
             $page->setContents($this->contentRepository->findByPid($page->getUid()));
         }
     }
     if ($this->settings['pageMode'] === 'nested') {
         $pages = $this->convertFlatToNestedPagesArray($pages, $rootPageUids);
     }
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'ModifyPages', array(&$pages, $this));
     $this->view->assign('pages', $pages);
 }
示例#15
0
 /**
  * Tracks display of an object on a page
  * 
  * @param \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject $object Object to use
  * @param mixed $hash Hash or page id (depending on the type) for which the object display will be associated
  * @param string $type 'hash' (for only one hash) or 'id' (for complete page cache of a page, for all hash combinations)
  * @return void
  */
 public function trackObjectOnPage(\TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject $object = NULL, $type = 'hash', $hash = false)
 {
     if ($object && !$this->ajaxDispatcher->getIsActive()) {
         $this->signalSlotDispatcher->dispatch(__CLASS__, self::SIGNAL_PreTrackObjectOnPage, array('object' => $object, 'type' => $type, 'hash' => $hash));
         if ($type) {
             switch ($type) {
                 case 'id':
                     if (!$hash) {
                         $hash = intval($this->fe->id);
                     }
                     $pageHash = 'id-' . $hash;
                     break;
                 case 'hash':
                 default:
                     if (!$hash) {
                         $hash = $this->fe->getHash();
                     }
                     $pageHash = 'hash-' . $hash;
                     break;
             }
             $objectIdentifier = $this->getObjectIdentifierForObject($object);
             $sharedLock = null;
             $sharedLockAcquired = $this->acquireLock($sharedLock, $objectIdentifier, FALSE);
             if ($sharedLockAcquired) {
                 if ($this->trackingCache->has($objectIdentifier)) {
                     $pageHashs = $this->trackingCache->get($objectIdentifier);
                     if (!in_array($pageHash, $pageHashs)) {
                         $exclusiveLock = null;
                         $exclusiveLockAcquired = $this->acquireLock($exclusiveLock, $objectIdentifier . '-e', TRUE);
                         if ($exclusiveLockAcquired) {
                             $pageHashs = $this->trackingCache->get($objectIdentifier);
                             if (!in_array($pageHash, $pageHashs)) {
                                 $pageHashs[] = $pageHash;
                                 $this->trackingCache->set($objectIdentifier, array_unique($pageHashs));
                             }
                             $this->releaseLock($exclusiveLock);
                         }
                     }
                 } else {
                     $this->trackingCache->set($objectIdentifier, array($pageHash));
                 }
                 $this->releaseLock($sharedLock);
             }
         }
     }
     return;
 }
示例#16
0
 /**
  * Create Email Body
  *
  * @param array $email Array with all needed mail information
  * @return bool
  */
 protected function createEmailBody($email)
 {
     $standaloneView = TemplateUtility::getDefaultStandAloneView();
     $standaloneView->getRequest()->setControllerName('Form');
     $standaloneView->setTemplatePathAndFilename(TemplateUtility::getTemplatePath($email['template'] . '.html'));
     // variables
     $variablesWithMarkers = $this->mailRepository->getVariablesWithMarkersFromMail($this->mail);
     $standaloneView->assignMultiple($variablesWithMarkers);
     $standaloneView->assignMultiple($this->mailRepository->getLabelsWithMarkersFromMail($this->mail));
     $standaloneView->assignMultiple(['variablesWithMarkers' => ArrayUtility::htmlspecialcharsOnArray($variablesWithMarkers), 'powermail_all' => TemplateUtility::powermailAll($this->mail, 'mail', $this->settings, $this->type), 'powermail_rte' => $email['rteBody'], 'marketingInfos' => SessionUtility::getMarketingInfos(), 'mail' => $this->mail, 'email' => $email, 'settings' => $this->settings]);
     if (!empty($email['variables'])) {
         $standaloneView->assignMultiple($email['variables']);
     }
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'BeforeRender', [$standaloneView, $email, $this->mail, $this->settings]);
     $body = $standaloneView->render();
     $this->mail->setBody($body);
     return $body;
 }
示例#17
0
 /**
  * Commits the current persistence session.
  *
  * @return void
  */
 public function commit()
 {
     $this->_addedObjects = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage');
     $this->_removedObjects = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage');
     $this->_changedObjects = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage');
     parent::commit();
     foreach ($this->_addedObjects as $object) {
         $this->signalSlotDispatcher->dispatch('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Backend', 'afterInsertCommitObjectHijax', array('object' => $object));
     }
     foreach ($this->_removedObjects as $object) {
         $this->signalSlotDispatcher->dispatch('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Backend', 'afterRemoveCommitObjectHijax', array('object' => $object));
     }
     foreach ($this->_changedObjects as $object) {
         $this->signalSlotDispatcher->dispatch('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Backend', 'afterUpdateCommitObjectHijax', array('object' => $object));
     }
     $this->_addedObjects = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage');
     $this->_removedObjects = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage');
     $this->_changedObjects = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage');
 }
 /**
  * @param \Pluswerk\Simpleblog\Domain\Model\Post $post
  * @param \Pluswerk\Simpleblog\Domain\Model\Comment $comment
  */
 public function ajaxAction(\Pluswerk\Simpleblog\Domain\Model\Post $post, \Pluswerk\Simpleblog\Domain\Model\Comment $comment = NULL)
 {
     // Wenn der Kommentar leer ist, wird nicht persistiert
     if ($comment->getComment() == "") {
         return FALSE;
     }
     // Datum des Kommentars setzen und den Kommentar zum Post hinzufügen
     $comment->setCommentdate(new \DateTime());
     $post->addComment($comment);
     // Signal for comment
     $this->signalSlotDispatcher->dispatch(__CLASS__, 'beforeCommentCreation', array($comment, $post));
     $this->postRepository->update($post);
     $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager')->persistAll();
     $comments = $post->getComments();
     foreach ($comments as $comment) {
         $json[$comment->getUid()] = array('comment' => $comment->getComment(), 'commentdate' => $comment->getCommentdate());
     }
     return json_encode($json);
 }
示例#19
0
 /**
  * showAction function.
  *
  * @access public
  * @return void
  */
 public function showAction()
 {
     $pages = $this->getPagesWithoutExcludes();
     /*
      * Signal for other Extensions
      */
     /**
      * @var array $linksArr
      */
     $linksArr = array();
     $linksArr[] = array('uri' => 'http://google.de/', 'lastModified' => time());
     $dataArr = array();
     $dataArr[] = array('plugin' => 'Plugin', 'controller' => 'Controller', 'action' => 'Action', 'extension' => 'Extension', 'pageUid' => 1, 'lastModified' => time(), 'arguments' => array('key' => 'value'));
     $this->signalSlotDispatcher->dispatch(__CLASS__, 'addExtensionLinks', array(&$linksArr, &$dataArr));
     unset($linksArr[0]);
     unset($dataArr[0]);
     $this->view->assign('pages', $pages);
     $this->view->assign('linkArr', $linksArr);
     $this->view->assign('dataArr', $dataArr);
 }
示例#20
0
 /**
  * Ajax action - deletes a post in the repository
  *
  * @param \Lobacher\Simpleblog\Domain\Model\Post $post
  * @param \Lobacher\Simpleblog\Domain\Model\Comment $comment
  *
  * @return bool|string
  */
 public function ajaxAction(\Lobacher\Simpleblog\Domain\Model\Post $post, \Lobacher\Simpleblog\Domain\Model\Comment $comment = NULL)
 {
     file_put_contents('./debug.txt', print_r($comment, true), FILE_APPEND);
     file_put_contents('./debug.txt', print_r("\n-----------------\n", true), FILE_APPEND);
     if ($comment->getComment() == "") {
         return FALSE;
     }
     // set datetime of comment and add comment to Post
     $comment->setCommentdate(new \DateTime());
     $post->addComment($comment);
     // signal for comments
     $this->signalSlotDispatcher->dispatch(__CLASS__, 'beforeCommentCreation', array($comment, $post));
     $this->postRepository->update($post);
     $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager')->persistAll();
     $comments = $post->getComments();
     foreach ($comments as $comment) {
         $json[$comment->getUid()] = array('comment' => $comment->getComment(), 'commentdate' => $comment->getCommentdate());
     }
     return json_encode($json);
 }
示例#21
0
 /**
  * Initialize fe_user object
  *
  * @param array $userdata
  *
  * @return void
  */
 protected function initFrontendEuser(array $userdata)
 {
     /** @var $feUser \TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication */
     $feUser = $this->objectManager->get(\TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication::class);
     $feUser->lockIP = $GLOBALS['TYPO3_CONF_VARS']['FE']['lockIP'];
     $feUser->checkPid = $GLOBALS['TYPO3_CONF_VARS']['FE']['checkFeUserPid'];
     $feUser->lifetime = intval($GLOBALS['TYPO3_CONF_VARS']['FE']['lifetime']);
     // List of pid's acceptable
     $feUser->checkPid_value = $this->database->cleanIntList(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('pid'));
     if ($GLOBALS['TYPO3_CONF_VARS']['FE']['dontSetCookie']) {
         $feUser->dontSetCookie = 1;
     }
     $feUser->start();
     $feUser->unpack_uc('');
     $feUser->fetchSessionData();
     $userdata[$feUser->lastLogin_column] = $GLOBALS['EXEC_TIME'];
     $userdata['is_online'] = $GLOBALS['EXEC_TIME'];
     $feUser->user = $userdata;
     $GLOBALS['TSFE']->fe_user =& $feUser;
     $this->updateLastLogin($feUser);
     $feUser->setKey('ses', 'SfRegisterAutoLoginUser', true);
     $this->signalSlotDispatcher->dispatch(__CLASS__, 'save', array('frontend' => &$GLOBALS['TSFE']));
 }
示例#22
0
 /**
  * @param string $name
  * @param array  $configuration
  * @return $this
  * @throws \TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException
  * @throws \TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotReturnException
  */
 protected function emitSignal($name, array &$configuration)
 {
     $this->signalSlotDispatcher->dispatch(__CLASS__, $name, [$this, $configuration]);
 }
示例#23
0
 /**
  * Emits a signal after mapping a single row.
  *
  * @param DomainObjectInterface $object The mapped object
  */
 protected function emitAfterMappingSingleRow(DomainObjectInterface $object)
 {
     $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterMappingSingleRow', [$object]);
 }
 /**
  * Emits signal
  *
  * @param string $signalName name of the signal slot
  * @param array $signalArguments arguments for the signal slot
  */
 protected function emitSignal($signalName, array $signalArguments)
 {
     $this->signalSlotDispatcher->dispatch('GeorgRinger\\News\\Domain\\Service\\CategoryImportService', $signalName, $signalArguments);
 }
示例#25
0
 /**
  * Emits a signal after extension files were imported
  *
  * @param string $destinationAbsolutePath
  */
 protected function emitAfterExtensionFileImportSignal($destinationAbsolutePath)
 {
     $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterExtensionFileImport', array($destinationAbsolutePath, $this));
 }
 /**
  * Emits packages may have changed signal
  */
 protected function emitPackagesMayHaveChangedSignal()
 {
     $this->signalSlotDispatcher->dispatch('PackageManagement', 'packagesMayHaveChanged');
 }
 /**
  * Emits a signal before a password reset mail is sent
  *
  * @param	PasswordResetRequestTransferObject	$passwordResetRequestTransferObject
  * @return void
  */
 protected function emitBeforePasswordResetMailSendSignal(PasswordResetRequestTransferObject $passwordResetRequestTransferObject)
 {
     $this->signalSlotDispatcher->dispatch(__CLASS__, 'beforePasswordResetMailSend', array($passwordResetRequestTransferObject));
 }
 /**
  * @param array $user
  *
  * @return int
  */
 public function authUser(array $user)
 {
     if (!$this->isServiceResponsible()) {
         return self::STATUS_AUTHENTICATION_FAILURE_CONTINUE;
     }
     $result = self::STATUS_AUTHENTICATION_FAILURE_CONTINUE;
     if ($user) {
         $result = self::STATUS_AUTHENTICATION_SUCCESS_BREAK;
     }
     $this->signalSlotDispatcher->dispatch(__CLASS__, 'authUser', [$user, &$result, $this]);
     return $result;
 }
示例#29
0
 /**
  * Returns the mirror URL for a given extension.
  *
  * @param string $extensionKey
  * @return string
  */
 protected function getMirrorUrl($extensionKey)
 {
     $this->signalSlotDispatcher->dispatch(__CLASS__, 'postProcessMirrorUrl', ['extensionKey' => $extensionKey, 'mirrorUrl' => &$this->mirrorUrl]);
     return $this->mirrorUrl;
 }
 /**
  * action show
  *
  * @return void
  */
 public function showAction()
 {
     // Assign multiple values
     $viewAssign = array();
     $this->cObj = $this->configurationManager->getContentObject();
     $this->data = $this->cObj->data;
     $viewAssign['uid'] = $this->data['uid'];
     switch ($this->settings['contenttype']) {
         case 'iframe':
             $viewAssign = GeneralUtility::array_merge($viewAssign, $this->iframe());
             break;
         case 'reference':
         case 'inline':
             if ($this->settings['content']['procedure_reference'] == 'ajax' && !empty($this->settings['contenttype']) || $this->settings['content']['procedure_inline'] == 'ajax') {
                 $viewAssign = GeneralUtility::array_merge($viewAssign, $this->ajax());
             } elseif (($this->settings['content']['procedure_reference'] && !empty($this->settings['contenttype'])) == 'inline' || $this->settings['content']['procedure_inline'] == 'inline') {
                 $viewAssign = GeneralUtility::array_merge($viewAssign, $this->inline());
             } elseif ($this->settings['content']['procedure_reference'] == '' && $this->settings['content']['procedure_inline'] == '') {
                 // Add error if no method (inline or ajax) has been selected
                 $this->addFlashMessage('Please select the method (inline or ajax) to display Magnific Popup content', 'Select method', AbstractMessage::WARNING);
             } elseif ($this->settings['content']['procedure_reference'] != '' && empty($this->settings['contenttype'])) {
                 // Add error if no content has been selected
                 $this->addFlashMessage('Please select a content to display with Magnific Popup', 'Select content', AbstractMessage::WARNING);
             }
             break;
         default:
             // Add error if no "Display type" has been selected
             $this->addFlashMessage('Please select a "Display type" to use Magnific Popup', 'Select "Display type"', AbstractMessage::WARNING);
     }
     // Signal for show action (may be used to modify the array assigned to fluid-template)
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__, array('data' => $this->data, 'settings' => $this->settings, 'viewAssign' => &$viewAssign));
     // Assign array to fluid-template
     $this->view->assignMultiple($viewAssign);
 }