Пример #1
0
 /**
  * Timetracking started depending if a Backend User is logged in
  *
  * @return void
  */
 protected function initializeTimeTracker()
 {
     $configuredCookieName = trim($GLOBALS['TYPO3_CONF_VARS']['BE']['cookieName']) ?: 'be_typo_user';
     /** @var TimeTracker timeTracker */
     $this->timeTracker = GeneralUtility::makeInstance(TimeTracker::class, $this->request->getCookieParams()[$configuredCookieName] ? true : false);
     $this->timeTracker->start();
 }
Пример #2
0
 /**
  * Timetracking started depending if a Backend User is logged in
  *
  * @return void
  */
 protected function initializeTimeTracker()
 {
     $configuredCookieName = trim($GLOBALS['TYPO3_CONF_VARS']['BE']['cookieName']) ?: 'be_typo_user';
     $this->timeTracker = new TimeTracker($this->request->getCookieParams()[$configuredCookieName] ? true : false);
     // We have to define this as reference here, because there is code around
     // which exchanges the TT object in the global variable. The reference ensures
     // that the $timeTracker member always works on the same object as the global variable.
     // This is a dirty workaround and bypasses the protected access modifier of the $timeTracker member.
     $GLOBALS['TT'] =& $this->timeTracker;
     $this->timeTracker->start();
 }
Пример #3
0
 /**
  * Timetracking started depending if a Backend User is logged in
  *
  * @return void
  */
 protected function initializeTimeTracker()
 {
     $configuredCookieName = trim($GLOBALS['TYPO3_CONF_VARS']['BE']['cookieName']);
     if (empty($configuredCookieName)) {
         $configuredCookieName = 'be_typo_user';
     }
     if ($_COOKIE[$configuredCookieName]) {
         $this->timeTracker = new TimeTracker();
     } else {
         $this->timeTracker = new NullTimeTracker();
     }
     // We have to define this as reference here, because there is code around
     // which exchanges the TT object in the global variable. The reference ensures
     // that the $timeTracker member always works on the same object as the global variable.
     // This is a dirty workaround and bypasses the protected access modifier of the $timeTracker member.
     $GLOBALS['TT'] =& $this->timeTracker;
     $this->timeTracker->start();
 }
Пример #4
0
 /**
  * Create and add element by type.
  * This can be a derived Typoscript object by "<",
  * a form element, or a regular Typoscript object.
  *
  * @param AbstractElement $parentElement The parent for the new element
  * @param string $class Classname for the element
  * @param array $arguments Configuration array
  * @return void
  */
 public function setElementType(AbstractElement $parentElement, $class, array $arguments)
 {
     if (in_array($class, \TYPO3\CMS\Form\Utility\FormUtility::getInstance()->getFormObjects())) {
         $this->addElement($parentElement, $class, $arguments);
     } elseif ($this->disableContentElement === FALSE) {
         if ($class[0] === '<') {
             $key = trim(substr($class, 1));
             /** @var $typoscriptParser \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser */
             $typoscriptParser = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::class);
             $oldArguments = $arguments;
             list($class, $arguments) = $typoscriptParser->getVal($key, $this->frontendController->tmpl->setup);
             if (is_array($oldArguments) && count($oldArguments)) {
                 $arguments = array_replace_recursive($arguments, $oldArguments);
             }
             $this->timeTracker->incStackPointer();
             $contentObject = array('cObj' => $class, 'cObj.' => $arguments);
             $this->addElement($parentElement, 'content', $contentObject);
             $this->timeTracker->decStackPointer();
         } else {
             $contentObject = array('cObj' => $class, 'cObj.' => $arguments);
             $this->addElement($parentElement, 'content', $contentObject);
         }
     }
 }
 /**
  * Returns a COMPLETE list of phash-integers matching the search-result composed of the search-words in the sWArr array.
  * The list of phash integers are unsorted and should be used for subsequent selection of index_phash records for display of the result.
  *
  * @param array $sWArr Search word array
  * @return string List of integers
  */
 public function getPhashList($sWArr)
 {
     // Initialize variables:
     $c = 0;
     $totalHashList = array();
     // This array accumulates the phash-values
     // Traverse searchwords; for each, select all phash integers and merge/diff/intersect them with previous word (based on operator)
     foreach ($sWArr as $k => $v) {
         // Making the query for a single search word based on the search-type
         $sWord = $v['sword'];
         $theType = (string) $this->piVars['type'];
         if (strstr($sWord, ' ')) {
             // If there are spaces in the search-word, make a full text search instead.
             $theType = 20;
         }
         $this->timeTracker->push('SearchWord "' . $sWord . '" - $theType=' . $theType);
         // Perform search for word:
         switch ($theType) {
             case '1':
                 // Part of word
                 $res = $this->searchWord($sWord, Utility\LikeWildcard::BOTH);
                 break;
             case '2':
                 // First part of word
                 $res = $this->searchWord($sWord, Utility\LikeWildcard::RIGHT);
                 break;
             case '3':
                 // Last part of word
                 $res = $this->searchWord($sWord, Utility\LikeWildcard::LEFT);
                 break;
             case '10':
                 // Sounds like
                 /**
                  * Indexer object
                  *
                  * @var \TYPO3\CMS\IndexedSearch\Indexer
                  */
                 // Initialize the indexer-class
                 $indexerObj = GeneralUtility::makeInstance(\TYPO3\CMS\IndexedSearch\Indexer::class);
                 // Perform metaphone search
                 $res = $this->searchMetaphone($indexerObj->metaphone($sWord, $this->storeMetaphoneInfoAsWords));
                 unset($indexerObj);
                 break;
             case '20':
                 // Sentence
                 $res = $this->searchSentence($sWord);
                 $this->piVars['order'] = 'mtime';
                 // If there is a fulltext search for a sentence there is a likeliness that sorting cannot be done by the rankings from the rel-table (because no relations will exist for the sentence in the word-table). So therefore mtime is used instead. It is not required, but otherwise some hits may be left out.
                 break;
             default:
                 // Distinct word
                 $res = $this->searchDistinct($sWord);
         }
         // If there was a query to do, then select all phash-integers which resulted from this.
         if ($res) {
             // Get phash list by searching for it:
             $phashList = array();
             while ($row = $this->databaseConnection->sql_fetch_assoc($res)) {
                 $phashList[] = $row['phash'];
             }
             $this->databaseConnection->sql_free_result($res);
             // Here the phash list are merged with the existing result based on whether we are dealing with OR, NOT or AND operations.
             if ($c) {
                 switch ($v['oper']) {
                     case 'OR':
                         $totalHashList = array_unique(array_merge($phashList, $totalHashList));
                         break;
                     case 'AND NOT':
                         $totalHashList = array_diff($totalHashList, $phashList);
                         break;
                     default:
                         // AND...
                         $totalHashList = array_intersect($totalHashList, $phashList);
                 }
             } else {
                 $totalHashList = $phashList;
             }
         }
         $this->timeTracker->pull();
         $c++;
     }
     return implode(',', $totalHashList);
 }
Пример #6
0
 /**
  * Set log message function wrapper for TT logging
  *
  * @param string $msg Message to set
  * @param int $errorNum Error number
  * @return void
  */
 public function log_setTSlogMessage($msg, $errorNum = 0)
 {
     $this->timeTracker->setTSlogMessage($msg, $errorNum);
     $this->internal_log[] = $msg;
 }