/**
  * @param Schema $schema
  * @return void
  */
 public function up(Schema $schema)
 {
     $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
     $now = new Now();
     $default = $now->format($this->platform->getDateTimeFormatString());
     $this->addSql("ALTER TABLE typo3_typo3cr_domain_model_nodedata ADD creationdatetime DATETIME NOT NULL, ADD lastmodificationdatetime DATETIME NOT NULL, ADD lastpublicationdatetime DATETIME DEFAULT NULL");
     $this->addSql("UPDATE typo3_typo3cr_domain_model_nodedata SET creationdatetime = '" . $default . "', lastmodificationdatetime = '" . $default . "'");
     $this->addSql("UPDATE typo3_typo3cr_domain_model_nodedata SET lastpublicationdatetime = '" . $default . "' WHERE workspace = 'live'");
 }
 /**
  * @param Schema $schema
  * @return void
  */
 public function up(Schema $schema)
 {
     $this->abortIf($this->connection->getDatabasePlatform()->getName() != "postgresql");
     $now = new Now();
     $default = $now->format($this->platform->getDateTimeFormatString());
     $this->addSql("ALTER TABLE typo3_typo3cr_domain_model_nodedata ADD creationdatetime TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL DEFAULT '" . $default . "'");
     $this->addSql("ALTER TABLE typo3_typo3cr_domain_model_nodedata ALTER COLUMN creationdatetime DROP DEFAULT");
     $this->addSql("ALTER TABLE typo3_typo3cr_domain_model_nodedata ADD lastmodificationdatetime TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL DEFAULT '" . $default . "'");
     $this->addSql("ALTER TABLE typo3_typo3cr_domain_model_nodedata ALTER COLUMN lastmodificationdatetime DROP DEFAULT");
     $this->addSql("ALTER TABLE typo3_typo3cr_domain_model_nodedata ADD lastpublicationdatetime TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL");
     $this->addSql("UPDATE typo3_typo3cr_domain_model_nodedata SET lastpublicationdatetime = '" . $default . "' WHERE workspace = 'live'");
 }
 /**
  * Renders a DateTime formatted relative to the current date.
  * Shows the time if the date is the current date.
  * Shows the month and date if the date is the current year.
  * Shows the year/month/date if the date is not the current year.
  *
  * @param \DateTime $date
  * @return string an <img...> html tag
  * @throws \InvalidArgumentException
  */
 public function render(\DateTime $date = null)
 {
     if ($date === null) {
         $date = $this->renderChildren();
     }
     if (!$date instanceof \DateTime) {
         throw new \InvalidArgumentException('No valid date given,', 1424647058);
     }
     // More than 11 months ago
     $now = new Now();
     if ($date < $now->modify('-11 months')) {
         return $date->format('Y M j');
     }
     // Same day of same year
     $now = new Now();
     if ($date->format('Y z') === $now->format('Y z')) {
         return $date->format('H:i');
     }
     return $date->format('M j');
 }
 /**
  * Checks whether the token is expired
  *
  * @param array $tokenData
  * @return void
  * @throws AccessDeniedException
  */
 protected function verifyExpiration(array $tokenData)
 {
     if (!isset($tokenData['expirationDateTime'])) {
         return;
     }
     $expirationDateTime = \DateTime::createFromFormat(\DateTime::ISO8601, $tokenData['expirationDateTime']);
     if ($this->now instanceof DependencyProxy) {
         $this->now->_activateDependency();
     }
     if ($expirationDateTime < $this->now) {
         throw new AccessDeniedException(sprintf('Token expired!%sThis token expired at "%s"', chr(10), $expirationDateTime->format(\DateTime::ISO8601)), 1429697439);
     }
 }
 /**
  * {@inheritdoc}
  *
  * @param FlowQuery $flowQuery The FlowQuery object
  * @param array $arguments None
  * @return integer The cache lifetime in seconds or NULL if either no content collection was given or no child node had a "hiddenBeforeDateTime" or "hiddenAfterDateTime" property set
  */
 public function evaluate(FlowQuery $flowQuery, array $arguments)
 {
     $minimumDateTime = null;
     foreach ($flowQuery->getContext() as $contextNode) {
         $hiddenBeforeDateTime = $contextNode->getHiddenBeforeDateTime();
         if ($hiddenBeforeDateTime !== null && $hiddenBeforeDateTime > $this->now && ($minimumDateTime === null || $hiddenBeforeDateTime < $minimumDateTime)) {
             $minimumDateTime = $hiddenBeforeDateTime;
         }
         $hiddenAfterDateTime = $contextNode->getHiddenAfterDateTime();
         if ($hiddenAfterDateTime !== null && $hiddenAfterDateTime > $this->now && ($minimumDateTime === null || $hiddenAfterDateTime < $minimumDateTime)) {
             $minimumDateTime = $hiddenAfterDateTime;
         }
     }
     if ($minimumDateTime !== null) {
         $maximumLifetime = $minimumDateTime->getTimestamp() - $this->now->getTimestamp();
         if ($maximumLifetime > 0) {
             return $maximumLifetime;
         }
     }
     return null;
 }
예제 #6
0
 /**
  * @param string $password,
  * @param string $passwordconfirm
  * @param string $code
  * @return string|void
  */
 public function changePasswordAction($password = NULL, $passwordconfirm = NULL, $code = NULL)
 {
     if ($code !== NULL) {
         $cryptJson = $code;
         $cryptKey = md5($this->providerName);
         $uncryptJson = base64_decode($cryptJson);
         $uncryptJson = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $cryptKey, $uncryptJson, MCRYPT_MODE_CBC, md5($cryptKey));
         $uncryptJson = rtrim($uncryptJson, "");
         $json = json_decode($uncryptJson);
     } else {
         $json = NULL;
     }
     $this->view->assign('code', $code);
     // @TODO Check if User has random number
     if ($json != NULL) {
         if ($this->time->getTimestamp() - $json->date > 86400) {
             $this->flashMessageContainer->addMessage(new \TYPO3\Flow\Error\Error($this->translator->translateById('login.messages.registration.not_valid', array(), NULL, NULL, 'Main', 'Incvisio.LostFound')));
             $this->redirect('index', 'Standard', NULL, array());
         } else {
             $account = $this->accountRepository->findByAccountIdentifierAndAuthenticationProviderName($json->username, $this->providerName);
             if ($password == $passwordconfirm && $password !== NULL) {
                 $account->setExpirationDate(NULL);
                 $account->setCredentialsSource($this->hashService->hashPassword($password, 'default'));
                 $this->accountRepository->update($account);
                 $this->flashMessageContainer->addMessage(new Message($this->translator->translateById('login.login.update', array(), NULL, NULL, 'Main', 'Incvisio.LostFound')));
                 $this->redirect('index', 'Standard', NULL, array());
             } else {
                 if ($password !== NULL) {
                     $this->flashMessageContainer->addMessage(new \TYPO3\Flow\Error\Error("Sorry"));
                 }
             }
         }
     } else {
         $this->flashMessageContainer->addMessage(new \TYPO3\Flow\Error\Error($this->translator->translateById('login.messages.registration.not_valid', array(), NULL, NULL, 'Main', 'Incvisio.LostFound')));
         $this->redirect('index', 'Standard', NULL, array());
     }
 }