Exemplo n.º 1
0
 /**
  * Entry method for use as TCEMain "inline" field filter
  *
  * @param array $parameters
  * @param \TYPO3\CMS\Core\DataHandler\DataHandler $tceMain
  * @return array
  */
 public function filterInlineChildren(array $parameters, \TYPO3\CMS\Core\DataHandler\DataHandler $tceMain)
 {
     $values = $parameters['values'];
     if ($parameters['allowedFileExtensions']) {
         $this->setAllowedFileExtensions($parameters['allowedFileExtensions']);
     }
     if ($parameters['disallowedFileExtensions']) {
         $this->setDisallowedFileExtensions($parameters['disallowedFileExtensions']);
     }
     $cleanValues = array();
     foreach ($values as $value) {
         if (empty($value)) {
             continue;
         }
         $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode('_', $value, 2);
         $fileReferenceUid = $parts[count($parts) - 1];
         $fileReference = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileReferenceObject($fileReferenceUid);
         $file = $fileReference->getOriginalFile();
         if ($this->isAllowed($file)) {
             $cleanValues[] = $value;
         } else {
             // Remove the erroneously created reference record again
             $tceMain->deleteAction('sys_file_reference', $fileReferenceUid);
         }
     }
     return $cleanValues;
 }
 /**
  * Redirecting the user after the processing has been done.
  * Might also display error messages directly, if any.
  *
  * @return void
  * @todo Define visibility
  */
 public function finish()
 {
     // Prints errors, if...
     if ($this->prErr) {
         $this->tce->printLogErrorMessages($this->redirect);
     }
     if ($this->redirect && !$this->tce->debug) {
         \TYPO3\CMS\Core\Utility\HttpUtility::redirect($this->redirect);
     }
 }
Exemplo n.º 3
0
 /**
  * @test
  */
 public function logFormatsDetailMessageWithAdditionalDataInLocalErrorArray()
 {
     $backendUser = $this->getMock('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
     $this->fixture->BE_USER = $backendUser;
     $this->fixture->enableLogging = TRUE;
     $this->fixture->errorLog = array();
     $logDetails = uniqid('details');
     $this->fixture->log('', 23, 0, 42, 1, '%1s' . $logDetails . '%2s', -1, array('foo', 'bar'));
     $expected = 'foo' . $logDetails . 'bar';
     $this->assertStringEndsWith($expected, $this->fixture->errorLog[0]);
 }