/**
  * Includes the locallang file for the 'formhandler' extension
  *
  * @return array The LOCAL_LANG array
  */
 function includeLocalLang()
 {
     $llFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('formhandler') . 'Resources/Language/locallang_db.xml';
     $parser = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Parser\\LocallangXmlParser');
     $LOCAL_LANG = $parser->getParsedData($llFile, $GLOBALS['LANG']->lang, 'utf-8');
     return $LOCAL_LANG;
 }
 /**
  * collect all fileinformations of given file and
  * save them to the global fileinformation array
  *
  * @param string $file
  * @return boolean is valid file?
  */
 protected function setFileInformations($file)
 {
     $this->fileInfo = array();
     // reset previously information to have a cleaned object
     $this->file = $file instanceof \TYPO3\CMS\Core\Resource\File ? $file : NULL;
     if (is_string($file) && !empty($file)) {
         $this->fileInfo = TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($file);
         $this->fileInfo['mtime'] = filemtime($file);
         $this->fileInfo['atime'] = fileatime($file);
         $this->fileInfo['owner'] = fileowner($file);
         $this->fileInfo['group'] = filegroup($file);
         $this->fileInfo['size'] = filesize($file);
         $this->fileInfo['type'] = filetype($file);
         $this->fileInfo['perms'] = fileperms($file);
         $this->fileInfo['is_dir'] = is_dir($file);
         $this->fileInfo['is_file'] = is_file($file);
         $this->fileInfo['is_link'] = is_link($file);
         $this->fileInfo['is_readable'] = is_readable($file);
         $this->fileInfo['is_uploaded'] = is_uploaded_file($file);
         $this->fileInfo['is_writeable'] = is_writeable($file);
     }
     if ($file instanceof \TYPO3\CMS\Core\Resource\File) {
         $pathInfo = \TYPO3\CMS\Core\Utility\PathUtility::pathinfo($file->getName());
         $this->fileInfo = array('file' => $file->getName(), 'filebody' => $file->getNameWithoutExtension(), 'fileext' => $file->getExtension(), 'realFileext' => $pathInfo['extension'], 'atime' => $file->getCreationTime(), 'mtime' => $file->getModificationTime(), 'owner' => '', 'group' => '', 'size' => $file->getSize(), 'type' => 'file', 'perms' => '', 'is_dir' => FALSE, 'is_file' => $file->getStorage()->getDriverType() === 'Local' ? is_file($file->getForLocalProcessing(FALSE)) : TRUE, 'is_link' => $file->getStorage()->getDriverType() === 'Local' ? is_link($file->getForLocalProcessing(FALSE)) : FALSE, 'is_readable' => TRUE, 'is_uploaded' => FALSE, 'is_writeable' => FALSE);
     }
     return $this->fileInfo !== array();
 }
 /**
  * get all content elements containing a t3s_content-Plugin
  *
  * @return array Array containing tt_content records
  */
 public function getTtContentRecordsWithT3sPlugin()
 {
     $targetPid = intval($this->indexerConfig['targetpid']);
     if ($targetPid) {
         $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tt_content', '1=1' . ' AND pid=' . $targetPid . ' AND CType="list"' . ' AND list_type="t3s_content_pi1"' . ' AND hidden=0 AND deleted=0', '', '', '', 'uid');
         if ($rows) {
             foreach ($rows as $key => $row) {
                 if (TYPO3_VERSION_INTEGER >= 7000000) {
                     $xml = TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($row['pi_flexform']);
                 } else {
                     $xml = t3lib_div::xml2array($row['pi_flexform']);
                 }
                 $config = $xml['data']['general']['lDEF'];
                 $ttContentUids[] = $config['contentElements']['vDEF'];
             }
             $ttContentUids = implode(',', $ttContentUids);
             if (TYPO3_VERSION_INTEGER >= 7000000) {
                 $ttContentUids = TYPO3\CMS\Core\Utility\GeneralUtility::uniqueList($ttContentUids);
             } else {
                 $ttContentUids = t3lib_div::uniqueList($ttContentUids);
             }
             $ttContentRecords = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tt_content', ' uid IN (' . $ttContentUids . ')', '', '', '', 'uid');
             if ($ttContentRecords) {
                 return $ttContentRecords;
             }
         }
     }
     return array();
 }
 /**
  * Returns content of a file. If it's an image the content of the file is not returned but rather an image tag is.
  * This method is taken from tslib_content
  * TODO: cache result
  *
  * @param string The filename, being a TypoScript resource data type or a FAL-Reference (file:123)
  * @param string Additional parameters (attributes). Default is empty alt and title tags.
  * @return string If jpg,gif,jpeg,png: returns image_tag with picture in. If html,txt: returns content string
  * @see FILE()
  */
 public static function getFileResource($fName, $options = array())
 {
     if (!(is_object($GLOBALS['TSFE']) && is_object($GLOBALS['TSFE']->tmpl))) {
         tx_rnbase::load('tx_rnbase_util_Misc');
         tx_rnbase_util_Misc::prepareTSFE(array('force' => TRUE));
     }
     if (self::isFALReference($fName)) {
         /** @var FileRepository $fileRepository */
         $fileRepository = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
         $fileObject = $fileRepository->findByUid(intval(substr($fName, 5)));
         $incFile = is_object($fileObject) ? $fileObject->getForLocalProcessing(FALSE) : FALSE;
     } else {
         $incFile = self::getFileName($fName);
     }
     if ($incFile) {
         // Im BE muss ein absoluter Pfad verwendet werden
         $fullPath = TYPO3_MODE == 'BE' ? PATH_site . $incFile : $incFile;
         $utility = tx_rnbase_util_Typo3Classes::getGeneralUtilityClass();
         $fileinfo = $utility::split_fileref($incFile);
         if ($utility::inList('jpg,gif,jpeg,png', $fileinfo['fileext'])) {
             $imgFile = $incFile;
             $imgInfo = @getImageSize($imgFile);
             $addParams = isset($options['addparams']) ? $options['addparams'] : 'alt="" title=""';
             $ret = '<img src="' . $GLOBALS['TSFE']->absRefPrefix . $imgFile . '" width="' . $imgInfo[0] . '" height="' . $imgInfo[1] . '"' . self::getBorderAttr(' border="0"') . ' ' . $addParams . ' />';
         } elseif (file_exists($fullPath) && filesize($fullPath) < 1024 * 1024) {
             $ret = @file_get_contents($fullPath);
             $subpart = isset($options['subpart']) ? $options['subpart'] : '';
             if ($subpart) {
                 tx_rnbase::load('tx_rnbase_util_Templates');
                 $ret = tx_rnbase_util_Templates::getSubpart($ret, $subpart);
             }
         }
     }
     return $ret;
 }
 function listAvailableOrderingsForAdmin(&$config)
 {
     $this->init();
     $this->lang->init($GLOBALS['BE_USER']->uc['lang']);
     // get orderings
     $fieldLabel = $this->lang->sL('LLL:EXT:ke_search/locallang_db.php:tx_kesearch_index.relevance');
     $notAllowedFields = 'uid,pid,tstamp,crdate,cruser_id,starttime,endtime,fe_group,targetpid,content,params,type,tags,abstract,language,orig_uid,orig_pid,hash';
     if (!$config['config']['relevanceNotAllowed']) {
         $config['items'][] = array($fieldLabel . ' UP', 'score asc');
         $config['items'][] = array($fieldLabel . ' DOWN', 'score desc');
     }
     $res = $GLOBALS['TYPO3_DB']->sql_query('SHOW COLUMNS FROM tx_kesearch_index');
     while ($col = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         if (TYPO3_VERSION_INTEGER >= 7000000) {
             $isInList = TYPO3\CMS\Core\Utility\GeneralUtility::inList($notAllowedFields, $col['Field']);
         } else {
             $isInList = t3lib_div::inList($notAllowedFields, $col['Field']);
         }
         if (!$isInList) {
             $file = $GLOBALS['TCA']['tx_kesearch_index']['columns'][$col['Field']]['label'];
             $fieldLabel = $this->lang->sL($file);
             $config['items'][] = array($fieldLabel . ' UP', $col['Field'] . ' asc');
             $config['items'][] = array($fieldLabel . ' DOWN', $col['Field'] . ' desc');
         }
     }
 }
 public function fillIndexerConfig(&$params, $pObj)
 {
     // hook for custom registration of further indexerConfigurations
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['registerIndexerConfiguration'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['registerIndexerConfiguration'] as $_classRef) {
             $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             $_procObj->registerIndexerConfiguration($params, $pObj);
         }
     }
 }
 /**
  * tx_t3devapi_export::exportRecordsToXML()
  * Example :
  * $query['SELECT'] = 'uid,title,category';
  * $query['FROM'] = 'tt_news';
  * $query['WHERE'] = '';
  *
  * @param array $query
  * @return string
  */
 public function exportRecordsToXML($query)
 {
     $xmlObj = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_xml', 'typo3_export');
     $xmlObj->setRecFields($query['FROM'], $query['SELECT']);
     $xmlObj->renderHeader();
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($query['SELECT'], $query['FROM'], $query['WHERE'], $query['GROUPBY'], $query['ORDERBY'], $query['LIMIT']);
     $xmlObj->renderRecords($query['FROM'], $res);
     $xmlObj->renderFooter();
     $GLOBALS['TYPO3_DB']->sql_free_result($res);
     return $xmlObj->getResult();
 }
示例#8
0
 /**
  * Loads a template file and generate the content
  *
  * @param array $context datas to send
  * @return string
  */
 public function fluidView($context = array())
 {
     $renderer = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Fluid_View_TemplateView');
     $controllerContext = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Extbase_MVC_Controller_ControllerContext');
     $controllerContext->setRequest(TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Extbase_MVC_Web_Request'));
     $renderer->setControllerContext($controllerContext);
     $renderer->setPartialRootPath(TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey) . "res/partials/");
     $renderer->setTemplateRootPath(TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey) . "res/templates/");
     $renderer->setLayoutRootPath(TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey) . "res/layouts");
     $renderer->setTemplatePathAndFilename($this->template);
     foreach ($context as $key => $value) {
         $renderer->assign($key, $value);
     }
     return $renderer->render();
 }
 /**
  * The main method of the PlugIn
  *
  * @param	string		$content: The PlugIn content
  * @param	array		$conf: The PlugIn configuration
  * @return	The content that is displayed on the website
  */
 function main($content, $conf)
 {
     $this->ms = TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds();
     $this->conf = $conf;
     $this->pi_setPiVarDefaults();
     $this->pi_loadLL();
     // Configuring so caching is not expected. This value means that no cHash params are ever set.
     // We do this, because it's a USER_INT object!
     $this->pi_USER_INT_obj = 1;
     // initializes plugin configuration
     $this->init();
     if ($this->conf['resultPage'] != $GLOBALS['TSFE']->id) {
         $content = '<div id="textmessage">' . $this->pi_getLL('error_resultPage') . '</div>';
         return $this->pi_wrapInBaseClass($content);
     }
     // init template
     $this->initFluidTemplate();
     // hook for initials
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'] as $_classRef) {
             $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             $_procObj->addInitials($this);
         }
     }
     // assign isEmptySearch to fluid templates
     $this->fluidTemplateVariables['isEmptySearch'] = $this->isEmptySearch;
     // render "no results"-message, "too short words"-message and finally the result list
     $this->getSearchResults();
     // number of results
     $this->fluidTemplateVariables['numberofresults'] = $this->numberOfResults;
     // render links for sorting, fluid template variables are filled in class tx_kesearch_lib_sorting
     $this->renderOrdering();
     // process query time
     $queryTime = TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds() - $GLOBALS['TSFE']->register['ke_search_queryStartTime'];
     $this->fluidTemplateVariables['queryTime'] = $queryTime;
     $this->fluidTemplateVariables['queryTimeText'] = sprintf($this->pi_getLL('query_time'), $queryTime);
     // render pagebrowser
     if ($GLOBALS['TSFE']->id == $this->conf['resultPage']) {
         if ($this->conf['pagebrowserOnTop'] || $this->conf['pagebrowserAtBottom']) {
             $this->renderPagebrowser();
         }
     }
     // generate HTML output
     $this->resultListView->assignMultiple($this->fluidTemplateVariables);
     $htmlOutput = $this->resultListView->render();
     return $htmlOutput;
 }
示例#10
0
文件: Page.php 项目: Apen/t3devapi
 /**
  * Find all ids from given ids and level
  *
  * @param string  $pidList   comma separated list of ids
  * @param integer $recursive recursive levels
  * @return string comma separated list of ids
  */
 public static function extendPidListByChildren($pidList = '', $recursive = 0)
 {
     $recursive = (int) $recursive;
     if ($recursive <= 0) {
         return $pidList;
     }
     $queryGenerator = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\QueryGenerator');
     $recursiveStoragePids = $pidList;
     $storagePids = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $pidList);
     foreach ($storagePids as $startPid) {
         $pids = $queryGenerator->getTreeList($startPid, $recursive, 0, 'hidden=0');
         if (strlen($pids) > 0) {
             $recursiveStoragePids .= ',' . $pids;
         }
     }
     return $recursiveStoragePids;
 }
 public function listAvailableOrderingsForAdmin(&$config)
 {
     $this->init();
     $this->lang->init($GLOBALS['BE_USER']->uc['lang']);
     // get orderings
     $fieldLabel = $this->lang->sL('LLL:EXT:ke_search/locallang_db.php:tx_kesearch_index.relevance');
     if (!$config['config']['relevanceNotAllowed']) {
         $config['items'][] = array($fieldLabel . ' UP', 'score asc');
         $config['items'][] = array($fieldLabel . ' DOWN', 'score desc');
     }
     $res = $GLOBALS['TYPO3_DB']->sql_query('SHOW COLUMNS FROM tx_kesearch_index');
     while ($col = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $isInList = TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->notAllowedFields, $col['Field']);
         if (!$isInList) {
             $file = $GLOBALS['TCA']['tx_kesearch_index']['columns'][$col['Field']]['label'];
             $fieldLabel = $this->lang->sL($file);
             $config['items'][] = array($fieldLabel . ' UP', $col['Field'] . ' asc');
             $config['items'][] = array($fieldLabel . ' DOWN', $col['Field'] . ' desc');
         }
     }
 }
 /**
  * get Content of DOC file
  *
  * @param string $file
  * @return string The extracted content of the file
  */
 public function getContent($file)
 {
     // create the tempfile which will contain the content
     $tempFileName = TYPO3\CMS\Core\Utility\GeneralUtility::tempnam('doc_files-Indexer');
     // Delete if exists, just to be safe.
     @unlink($tempFileName);
     // generate and execute the pdftotext commandline tool
     $cmd = $this->app['catdoc'] . ' -s8859-1 -dutf-8 ' . escapeshellarg($file) . ' > ' . escapeshellarg($tempFileName);
     TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd);
     // check if the tempFile was successfully created
     if (@is_file($tempFileName)) {
         $content = TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($tempFileName);
         unlink($tempFileName);
     } else {
         return false;
     }
     // check if content was found
     if (strlen($content)) {
         return $content;
     } else {
         return false;
     }
 }
 /**
  * This function was called from indexer object and saves content to index table
  *
  * @return string content which will be displayed in backend
  */
 public function startIndexing()
 {
     $content = '';
     $table = 'tx_cal_event';
     // get the pages from where to index the news
     $indexPids = $this->getPidList($this->indexerConfig['startingpoints_recursive'], $this->indexerConfig['sysfolder'], $table);
     // add the tags of the parent page
     if ($this->indexerConfig['index_use_page_tags']) {
         $this->pageRecords = $this->getPageRecords($indexPids);
         $this->addTagsToRecords($indexPids);
     }
     // get all the glossary records to index, don't index hidden or
     // deleted glossary records, BUT  get the records with frontend user group
     // access restrictions or time (start / stop) restrictions.
     // Copy those restrictions to the index.
     $fields = '*';
     $where = 'pid IN (' . implode(',', $indexPids) . ') ';
     // index expired events?
     if (!$this->indexerConfig['cal_expired_events']) {
         $where .= ' AND ((UNIX_TIMESTAMP(start_date) > UNIX_TIMESTAMP()) OR (UNIX_TIMESTAMP(end_date) > UNIX_TIMESTAMP())) ';
     }
     // add enablefields
     $where .= TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table);
     $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where);
     $indexedRecordsCounter = 0;
     $resCount = $GLOBALS['TYPO3_DB']->sql_num_rows($res, 'res count: ');
     if ($resCount) {
         while ($record = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             // compile the information which should go into the index:
             // title, description
             $title = strip_tags($record['title']);
             $abstract = '';
             $fullContent = strip_tags($record['description']);
             // compile params for single view, example:
             // index.php?id=4749&tx_cal_controller[view]=event&tx_cal_controller[type]=tx_cal_phpicalendar&tx_cal_controller[uid]=3&tx_cal_controller[year]=2016&tx_cal_controller[month]=3&tx_cal_controller%5Bday%5D=13&cHash=02c5c65558b8f44e16bee0c6703132bf
             $paramsSingleView = array();
             $paramsSingleView['tx_cal_controller']['uid'] = $record['uid'];
             $params = rawurldecode('&' . http_build_query($paramsSingleView, NULL, '&'));
             // add tags from pages
             if ($this->indexerConfig['index_use_page_tags']) {
                 $tags = $this->pageRecords[intval($record['pid'])]['tags'];
             } else {
                 $tags = '';
             }
             // get category tags
             if ($record['category_id']) {
                 $this->buildCategoryTags($record['uid'], $tags);
             }
             // make it possible to modify the indexerConfig via hook
             $indexerConfig = $this->indexerConfig;
             // set additional fields
             $additionalFields = array();
             $additionalFields['orig_uid'] = $record['uid'];
             $additionalFields['orig_pid'] = $record['pid'];
             // set event start date as sortdate
             $additionalFields['sortdate'] = strtotime($record['start_date']) + $record['start_time'];
             // hook for custom modifications of the indexed data, e.g. the tags
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyCalIndexEntry'])) {
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyCalIndexEntry'] as $_classRef) {
                     $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                     $_procObj->modifyCalIndexEntry($title, $abstract, $fullContent, $params, $tags, $record, $additionalFields, $indexerConfig, $this);
                 }
             }
             // store this record to the index
             $this->pObj->storeInIndex($indexerConfig['storagepid'], $title, 'cal', $indexerConfig['targetpid'], $fullContent, $tags, $params, $abstract, $record['sys_language_uid'], $record['starttime'], $record['endtime'], $record['fe_group'], false, $additionalFields);
             $indexedRecordsCounter++;
         }
         $content = '<p><b>Indexer "' . $this->indexerConfig['title'] . '":</b><br />' . "\n" . $indexedRecordsCounter . ' "Calendar Base" records have been indexed.</p>' . "\n";
         $content .= $this->showErrors();
         $content .= $this->showTime();
     }
     return $content;
 }
 /**
  * get content of current page and save data to db
  * @param $uid page-UID that has to be indexed
  */
 function getPageContent($uid)
 {
     // get content elements for this page
     $fields = '*';
     $table = 'tt_content';
     $where = 'pid = ' . intval($uid);
     $where .= ' AND (' . $this->whereClauseForCType . ')';
     // add condition for not indexing gridelement columns with colPos = -2 (= invalid)
     if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('gridelements')) {
         $where .= ' AND colPos <> -2 ';
     }
     // don't index elements which are hidden or deleted, but do index
     // those with time restrictons, the time restrictens will be
     // copied to the index
     //$where .= t3lib_BEfunc::BEenableFields($table);
     $where .= ' AND hidden=0';
     $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
     // Get access restrictions for this page
     $pageAccessRestrictions = $this->getInheritedAccessRestrictions($uid);
     $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, $table, $where);
     if (count($rows)) {
         foreach ($rows as $row) {
             // skip this content element if the page itself is hidden or a
             // parent page with "extendToSubpages" set is hidden
             if ($pageAccessRestrictions['hidden']) {
                 continue;
             }
             if ($row['sys_language_uid'] > 0 && $this->cachedPageRecords[$row['sys_language_uid']][$row['pid']]['hidden']) {
                 continue;
             }
             // combine group access restrictons from page(s) and content element
             $feGroups = $this->getCombinedFeGroupsForContentElement($pageAccessRestrictions['fe_group'], $row['fe_group']);
             // skip this content element if either the page or the content
             // element is set to "hide at login"
             // and the other one has a frontend group attached to it
             if ($feGroups == DONOTINDEX) {
                 continue;
             }
             // get content for this content element
             $content = '';
             // get tags from page
             $tags = $this->pageRecords[$uid]['tags'];
             // assign categories as tags (as cleartext, eg. "colorblue")
             $categories = tx_kesearch_helper::getCategories($row['uid'], $table);
             tx_kesearch_helper::makeTags($tags, $categories['title_list']);
             // assign categories as generic tags (eg. "syscat123")
             tx_kesearch_helper::makeSystemCategoryTags($tags, $row['uid'], $table);
             // index header
             // add header only if not set to "hidden"
             if ($row['header_layout'] != 100) {
                 $content .= strip_tags($row['header']) . "\n";
             }
             // index content of this content element and find attached or linked files.
             // Attached files are saved as file references, the RTE links directly to
             // a file, thus we get file objects.
             if (in_array($row['CType'], $this->fileCTypes)) {
                 $fileObjects = $this->findAttachedFiles($row);
             } else {
                 $fileObjects = $this->findLinkedFilesInRte($row);
                 $content .= $this->getContentFromContentElement($row) . "\n";
             }
             // index the files fond
             $this->indexFiles($fileObjects, $row, $pageAccessRestrictions['fe_group]'], $tags) . "\n";
             // Combine starttime and endtime from page, page language overlay
             // and content element.
             // TODO:
             // If current content element is a localized content
             // element, fetch startdate and enddate from original conent
             // element as the localized content element cannot have it's
             // own start- end enddate
             $starttime = $pageAccessRestrictions['starttime'];
             if ($this->cachedPageRecords[$row['sys_language_uid']][$row['pid']]['starttime'] > $starttime) {
                 $starttime = $this->cachedPageRecords[$row['sys_language_uid']][$row['pid']]['starttime'];
             }
             if ($row['starttime'] > $starttime) {
                 $starttime = $row['starttime'];
             }
             $endtime = $pageAccessRestrictions['endtime'];
             if ($endtime == 0 || $this->cachedPageRecords[$row['sys_language_uid']][$row['pid']]['endtime'] && $this->cachedPageRecords[$row['sys_language_uid']][$row['pid']]['endtime'] < $endtime) {
                 $endtime = $this->cachedPageRecords[$row['sys_language_uid']][$row['pid']]['endtime'];
             }
             if ($endtime == 0 || $row['endtime'] && $row['endtime'] < $endtime) {
                 $endtime = $row['endtime'];
             }
             // prepare additionalFields (to be added via hook)
             $additionalFields = array();
             // make it possible to modify the indexerConfig via hook
             $indexerConfig = $this->indexerConfig;
             // hook for custom modifications of the indexed data, e. g. the tags
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyContentIndexEntry'])) {
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyContentIndexEntry'] as $_classRef) {
                     $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                     $_procObj->modifyContentIndexEntry($row['header'], $row, $tags, $row['uid'], $additionalFields, $indexerConfig);
                 }
             }
             // compile title from page title and content element title
             // TODO: make changeable via hook
             $title = $this->cachedPageRecords[$row['sys_language_uid']][$row['pid']]['title'];
             if ($row['header'] && $row['header_layout'] != 100) {
                 $title = $title . ' - ' . $row['header'];
             }
             // save record to index
             $this->pObj->storeInIndex($indexerConfig['storagepid'], $title, 'content', $row['pid'] . '#c' . $row['uid'], $content, $tags, '', '', $row['sys_language_uid'], $starttime, $endtime, $feGroups, false, $additionalFields);
             // count elements written to the index
             $this->counter++;
         }
     } else {
         return;
     }
     return;
 }
    /**
     * This function was called from indexer object and saves content to index table
     *
     * @return string content which will be displayed in backend
     */
    public function startIndexing()
    {
        $tagChar = $this->pObj->extConf['prePostTagChar'];
        $now = strtotime('today');
        // get YAC records from specified pid
        $fields = '*';
        $table = 'tx_keyac_dates';
        $where = 'pid IN (' . $this->indexerConfig['sysfolder'] . ') ';
        $where .= ' AND hidden=0 AND deleted=0 ';
        // do not index passed events?
        if ($this->indexerConfig['index_passed_events'] == 'no') {
            $keYacProductsIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('ke_yac_products');
            if ($keYacProductsIsLoaded) {
                // special query if ke_yac_products loaded (VNR)
                $where .= '
					AND ((
						tx_keyacproducts_type<>"product"
						AND (startdat >= "' . time() . '" OR enddat >= "' . time() . '")
					) OR (tx_keyacproducts_type="product" AND tx_keyacproducts_product<>""))';
            } else {
                // "normal" YAC events
                $where .= ' AND (startdat >= "' . time() . '" OR enddat >= "' . time() . '")';
            }
        }
        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where, $groupBy = '', $orderBy = '', $limit = '');
        $resCount = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
        if ($resCount) {
            while ($yacRecord = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                // prepare content for storing in index table
                $title = strip_tags($yacRecord['title']);
                $tags = '';
                $params = '&tx_keyac_pi1[showUid]=' . intval($yacRecord['uid']);
                $abstract = str_replace('<br />', chr(13), $yacRecord['teaser']);
                $abstract = str_replace('<br>', chr(13), $abstract);
                $abstract = str_replace('</p>', chr(13), $abstract);
                $abstract = strip_tags($abstract);
                $content = strip_tags($yacRecord['bodytext']);
                $fullContent = $abstract . "\n" . $content;
                $targetPID = $this->indexerConfig['targetpid'];
                // get tags
                $yacRecordTags = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $yacRecord['tx_keyacsearchtags_tags'], true);
                $tags = '';
                $clearTextTags = '';
                if (count($yacRecordTags)) {
                    foreach ($yacRecordTags as $key => $tagUid) {
                        if ($tags) {
                            $tags .= ',' . $tagChar . $this->getTag($tagUid) . $tagChar;
                        } else {
                            $tags = $tagChar . $this->getTag($tagUid) . $tagChar;
                        }
                        $clearTextTags .= chr(13) . $this->getTag($tagUid, true);
                    }
                }
                // add clearText Tags to content
                if (!empty($clearTextTags)) {
                    $fullContent .= chr(13) . $clearTextTags;
                }
                // make it possible to modify the indexerConfig via hook
                $indexerConfig = $this->indexerConfig;
                // hook for custom modifications of the indexed data, e. g. the tags
                if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyYACIndexEntry'])) {
                    foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyYACIndexEntry'] as $_classRef) {
                        $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                        $_procObj->modifyYACIndexEntry($title, $abstract, $fullContent, $params, $tags, $yacRecord, $targetPID, $additionalFields, $indexerConfig);
                    }
                }
                // store data in index table
                $this->pObj->storeInIndex($indexerConfig['storagepid'], $title, 'ke_yac', $targetPID, $fullContent, $tags, $params, $abstract, $yacRecord['sys_language_uid'], $yacRecord['starttime'], $yacRecord['endtime'], $yacRecord['fe_group'], false, $additionalFields);
            }
        }
        $content = '<p><b>Indexer "' . $this->indexerConfig['title'] . '": ' . $resCount . ' YAC records have been indexed.</b></p>' . "\n";
        $content .= $this->showErrors();
        $content .= $this->showTime();
        return $content;
    }
 /**
  *
  * combines two string comma lists
  *
  * @param string $list1
  * @param string $list2
  * @author Christian Bülter <*****@*****.**>
  * @since 23.07.13
  * @return string
  */
 public function combineLists($list1 = '', $list2 = '')
 {
     if (!empty($list2) && !empty($list2)) {
         $list1 .= ',';
     }
     $list1 .= $list2;
     $returnValue = TYPO3\CMS\Core\Utility\GeneralUtility::uniqueList($list1);
     return $returnValue;
 }
 /**
  * change ordering
  * f.e. asc to desc and desc to asc
  *
  * @param string $direction asc or desc
  * @return string desc or asc. If you call this function with a not allowed string, exactly this string will be returned. Short: The function do nothing
  */
 public function changeOrdering($direction)
 {
     $allowedDirections = array('asc', 'desc');
     $direction = strtolower($direction);
     if (TYPO3_VERSION_INTEGER >= 7000000) {
         $isInArray = TYPO3\CMS\Core\Utility\GeneralUtility::inArray($allowedDirections, $direction);
     } else {
         $isInArray = t3lib_div::inArray($allowedDirections, $direction);
     }
     if (!empty($direction) && $isInArray) {
         if ($direction == 'asc') {
             $direction = 'desc';
         } else {
             $direction = 'asc';
         }
     }
     return $direction;
 }
 /**
  * This function was called from indexer object and saves content to index table
  * @return string content which will be displayed in backend
  */
 public function startIndexing()
 {
     $content = '';
     // get all the records to index
     // don't index hidden, deleted or not approved comments
     $fields = '*';
     $table = 'tx_comments_comments';
     $indexPids = $this->getPidList($this->indexerConfig['startingpoints_recursive'], $this->indexerConfig['sysfolder'], $table);
     if ($this->indexerConfig['index_use_page_tags']) {
         // add the tags of each page to the global page array
         $this->pageRecords = $this->getPageRecords($indexPids);
         $this->addTagsToRecords($indexPids);
     }
     $where = 'pid IN (' . implode(',', $indexPids) . ') ';
     $where .= ' AND approved=1';
     $where .= ' AND external_prefix IN ("' . implode('","', TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->indexerConfig['commenttypes'])) . '")';
     $where .= TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table);
     $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where);
     if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
         $count = 0;
         while ($comment = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             // compile the information which should go into the index
             $title = $this->compileCommentTitle($comment);
             $abstract = '';
             $content = trim(strip_tags($comment['content']));
             // use page ID stored in field "external_ref" as target page
             // makes sense for comments to page
             // Should be adjusted for other comments?
             if ($comment['external_prefix'] == 'pages') {
                 $external_ref_exploded = explode('_', $comment['external_ref']);
                 $targetPage = $external_ref_exploded[1];
             } else {
                 // TODO: Make the target page configurable, eg. for tt_news comments
                 //$targetPage = $indexerConfig['targetpid'];
                 $targetPage = 0;
             }
             // create tags
             if ($this->indexerConfig['index_use_page_tags']) {
                 $tags = $this->pageRecords[intval($comment['pid'])]['tags'];
             } else {
                 $tags = '';
             }
             // fill additional fields
             $additionalFields = array('orig_uid' => $comment['uid'], 'orig_pid' => $comment['pid'], 'sortdate' => $comment['crdate']);
             // make it possible to modify the indexerConfig via hook
             $indexerConfig = $this->indexerConfig;
             $params = '';
             // hook for custom modifications of the indexed data, e. g. the tags
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyCommentsIndexEntry'])) {
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyCommentsIndexEntry'] as $_classRef) {
                     $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                     $_procObj->modifyCommentsIndexEntry($title, $abstract, $content, $params, $tags, $comment, $additionalFields, $indexerConfig);
                 }
             }
             // ... and store them
             $this->pObj->storeInIndex($indexerConfig['storagepid'], $title, 'comments', $targetPage, $content, $tags, $params, $abstract, -1, 0, 0, '', false, $additionalFields);
             $count++;
         }
         $content = '<p><b>Indexer "' . $this->indexerConfig['title'] . '":</b><br />' . "\n" . $count . ' Comments have been indexed.</p>' . "\n";
         $content .= $this->showErrors();
         $content .= $this->showTime();
     }
     return $content;
 }
    /**
     * getRequestContentAddItemFieldsPictureDetails( )  :
     *
     * @return	string  $pictureDetails : XML tag with the picture details
     * @access private
     * @version  1.0.0
     * @since    0.0.3
     */
    private function getRequestContentAddItemFieldsPictureDetails()
    {
        global $TCA;
        $pictureDetails = null;
        // uploadfolder
        $table = $this->pObj->getDatamapTable();
        $tcaColumn = $this->getTcaConfFields('pictures');
        $uploadFolder = $TCA[$table]['columns'][$tcaColumn]['config']['uploadfolder'];
        $urlToPicture = TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $uploadFolder . '/';
        // #i0015, 141012, dwildt, 1+
        $urlToPicture = str_replace('https://', 'http://', $urlToPicture);
        //    var_dump(__METHOD__, __LINE__, $tcaColumn, $pictures, $uploadFolder, $GLOBALS['TYPO3_SITE_URL'],
        //            TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'), $url);
        $csvPictures = trim($this->getDatamapValueByTcaConfField('pictures'), ',');
        $arrPictures = explode(',', $csvPictures);
        $pictureUrl = null;
        foreach ($arrPictures as $picture) {
            $pictureUrl = $pictureUrl . '    <PictureURL>' . $urlToPicture . $picture . '</PictureURL>' . PHP_EOL;
        }
        if (empty($pictureUrl)) {
            return;
        }
        $pictureDetails = '  <PictureDetails>
' . $pictureUrl . '
  </PictureDetails>';
        return $pictureDetails;
    }
 /**
  * This function was called from indexer object and saves content to index table
  *
  * @return string content which will be displayed in backend
  */
 public function startIndexing()
 {
     $content = '';
     $this->conf['useHRDatesSingle'] = $this->indexerConfig['index_news_useHRDatesSingle'];
     $this->conf['useHRDatesSingleWithoutDay'] = $this->indexerConfig['index_news_useHRDatesSingleWithoutDay'];
     // get all the tt_news entries to index
     // don't index hidden or deleted news, BUT
     // get the news with frontend user group access restrictions
     // or time (start / stop) restrictions.
     // Copy those restrictions to the index.
     $fields = '*';
     $table = 'tt_news';
     $indexPids = $this->getPidList($this->indexerConfig['startingpoints_recursive'], $this->indexerConfig['sysfolder'], $table);
     if ($this->indexerConfig['index_use_page_tags']) {
         // add the tags of each page to the global page array
         $this->pageRecords = $this->getPageRecords($indexPids);
         $this->addTagsToRecords($indexPids);
     }
     $where = 'pid IN (' . implode(',', $indexPids) . ') ';
     if (TYPO3_VERSION_INTEGER >= 7000000) {
         $where .= TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table);
         $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
     } else {
         $where .= t3lib_befunc::BEenableFields($table);
         $where .= t3lib_befunc::deleteClause($table);
     }
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where);
     $counter = 0;
     if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
         while ($newsRecord = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             // if mode equals 'choose categories for indexing' (2). 1 = All
             if ($this->indexerConfig['index_news_category_mode'] == '2') {
                 if (TYPO3_VERSION_INTEGER >= 7000000) {
                     $enableFields = TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tt_news_cat') . TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tt_news_cat');
                 } else {
                     $enableFields = t3lib_befunc::BEenableFields('tt_news_cat') . t3lib_befunc::deleteClause('tt_news_cat');
                 }
                 $resCat = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query('tt_news_cat.uid', 'tt_news', 'tt_news_cat_mm', 'tt_news_cat', ' AND tt_news.uid = ' . $newsRecord['uid'] . $enableFields, '', '', '');
                 if ($GLOBALS['TYPO3_DB']->sql_num_rows($resCat)) {
                     $isInList = false;
                     while ($newsCat = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resCat)) {
                         // if category was found in list, set isInList to true and break further processing.
                         if (TYPO3_VERSION_INTEGER >= 7000000) {
                             if (TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->indexerConfig['index_news_category_selection'], $newsCat['uid'])) {
                                 $isInList = true;
                                 break;
                             }
                         } else {
                             if (t3lib_div::inList($this->indexerConfig['index_news_category_selection'], $newsCat['uid'])) {
                                 $isInList = true;
                                 break;
                             }
                         }
                     }
                     // if category was not found stop further processing and loop with next news record
                     if (!$isInList) {
                         continue;
                     }
                 }
             }
             // compile the information which should go into the index
             $type = 'tt_news';
             $title = strip_tags($newsRecord['title']);
             $abstract = strip_tags($newsRecord['short']);
             $content = strip_tags($newsRecord['bodytext']);
             // add keywords to content if not empty
             if (!empty($newsRecord['keywords'])) {
                 $content .= "\n" . $newsRecord['keywords'];
             }
             // create content
             $fullContent = $abstract . "\n" . $content;
             // create params and custom single view page:
             // if it is a default news (type = 0), add params
             // if it is an internal page (type = 1), put that into the "targetpid" field
             // if it is an external url (type = 2), put that into the "params" field
             if ($newsRecord['type'] == 1) {
                 $singleViewPage = $newsRecord['page'];
                 $params = '';
             } else {
                 if ($newsRecord['type'] == 2) {
                     $type = 'external:tt_news';
                     $singleViewPage = '';
                     $params = $newsRecord['ext_url'];
                 } else {
                     // get target page from category if set (first assigned category)
                     if (TYPO3_VERSION_INTEGER < 6002000) {
                         $ttnewsIsLoaded = t3lib_extMgm::isLoaded('tt_news');
                     } else {
                         $ttnewsIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('tt_news');
                     }
                     if ($ttnewsIsLoaded) {
                         $singleViewPage = $this->getSingleViewPageFromCategories($newsRecord['uid']);
                     }
                     $paramsSingleView = $this->getParamsForHrDateSingleView($newsRecord['datetime']);
                     $paramsSingleView['tx_ttnews']['tt_news'] = $newsRecord['uid'];
                     $params = '&' . http_build_query($paramsSingleView, NULL, '&');
                     $params = rawurldecode($params);
                 }
             }
             // create tags
             if ($this->indexerConfig['index_use_page_tags']) {
                 $tags = $this->pageRecords[intval($newsRecord['pid'])]['tags'];
             } else {
                 $tags = '';
             }
             // add additional fields
             $additionalFields = array();
             // crdate is always given, but can be overwritten
             $additionalFields['sortdate'] = $newsRecord['crdate'];
             // last changed date
             if (isset($newsRecord['datetime']) && $newsRecord['datetime'] > 0) {
                 $additionalFields['sortdate'] = $newsRecord['datetime'];
             }
             // fill orig_uid and orig_pid
             $additionalFields['orig_uid'] = $newsRecord['uid'];
             $additionalFields['orig_pid'] = $newsRecord['pid'];
             // make it possible to modify the indexerConfig via hook
             $indexerConfig = $this->indexerConfig;
             // overwrite default targetpid value from indexerconfig
             // only if $singleViewPage is set
             if ($singleViewPage) {
                 $indexerConfig['targetpid'] = $singleViewPage;
             }
             // hook for custom modifications of the indexed data, e. g. the tags
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyNewsIndexEntry'])) {
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyNewsIndexEntry'] as $_classRef) {
                     if (TYPO3_VERSION_INTEGER >= 7000000) {
                         $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                     } else {
                         $_procObj =& t3lib_div::getUserObj($_classRef);
                     }
                     $_procObj->modifyNewsIndexEntry($title, $abstract, $fullContent, $params, $tags, $newsRecord, $additionalFields, $indexerConfig);
                 }
             }
             // ... and store them
             $this->pObj->storeInIndex($indexerConfig['storagepid'], $title, $type, $indexerConfig['targetpid'], $fullContent, $tags, $params, $abstract, $newsRecord['sys_language_uid'], $newsRecord['starttime'], $newsRecord['endtime'], $newsRecord['fe_group'], false, $additionalFields);
             $counter++;
         }
         $content = '<p><b>Indexer "' . $this->indexerConfig['title'] . '":</b><br />' . "\n" . $counter . ' news have been indexed.</p>' . "\n";
         $content .= $this->showErrors();
         $content .= $this->showTime();
     }
     return $content;
 }
 /**
  * store collected data of defined indexers to db
  *
  * @param integer $storagepid
  * @param string $title
  * @param string $type
  * @param string $targetpid
  * @param string $content
  * @param string $tags
  * @param string $params
  * @param string $abstract
  * @param string $language
  * @param integer $starttime
  * @param integer $endtime
  * @param string $fe_group
  * @param boolean $debugOnly
  * @param array $additionalFields
  */
 function storeInIndex($storagePid, $title, $type, $targetPid, $content, $tags = '', $params = '', $abstract = '', $language = 0, $starttime = 0, $endtime = 0, $fe_group = '', $debugOnly = false, $additionalFields = array())
 {
     // if there are errors found in current record return false and break processing
     if (!$this->checkIfRecordHasErrorsBeforeIndexing($storagePid, $title, $type, $targetPid)) {
         return false;
     }
     // optionally add tag set in the indexer configuration
     if (!empty($this->indexerConfig['filteroption']) && (substr($type, 0, 4) != 'file' || substr($type, 0, 4) == 'file' && $this->indexerConfig['index_use_page_tags_for_files'] || $this->indexerConfig['type'] == 'file')) {
         $indexerTag = $this->getTag($this->indexerConfig['filteroption']);
         $tagChar = $this->extConf['prePostTagChar'];
         if ($tags) {
             $tags .= ',' . $tagChar . $indexerTag . $tagChar;
         } else {
             $tags = $tagChar . $indexerTag . $tagChar;
         }
         if (TYPO3_VERSION_INTEGER >= 7000000) {
             $tags = TYPO3\CMS\Core\Utility\GeneralUtility::uniqueList($tags);
         } else {
             $tags = t3lib_div::uniqueList($tags);
         }
     }
     $table = 'tx_kesearch_index';
     $fieldValues = $this->createFieldValuesForIndexing($storagePid, $title, $type, $targetPid, $content, $tags, $params, $abstract, $language, $starttime, $endtime, $fe_group, $additionalFields);
     // check if record already exists
     if (substr($type, 0, 4) == 'file') {
         $recordExists = $this->checkIfFileWasIndexed($fieldValues['type'], $fieldValues['hash']);
     } else {
         $recordExists = $this->checkIfRecordWasIndexed($fieldValues['orig_uid'], $fieldValues['pid'], $fieldValues['type'], $fieldValues['language']);
     }
     if ($recordExists) {
         // update existing record
         $where = 'uid=' . intval($this->currentRow['uid']);
         unset($fieldValues['crdate']);
         if ($debugOnly) {
             // do not process - just debug query
             t3lib_utility_Debug::debug($GLOBALS['TYPO3_DB']->UPDATEquery($table, $where, $fieldValues), 1);
         } else {
             // process storing of index record and return uid
             $this->prepareRecordForUpdate($fieldValues);
             return true;
         }
     } else {
         // insert new record
         if ($debugOnly) {
             // do not process - just debug query
             t3lib_utility_Debug::debug($GLOBALS['TYPO3_DB']->INSERTquery($table, $fieldValues, FALSE));
         } else {
             // process storing of index record and return uid
             $this->prepareRecordForInsert($fieldValues);
             return $GLOBALS['TYPO3_DB']->sql_insert_id();
         }
     }
 }
示例#22
0
 public function indexAction()
 {
     // assign contents to the view
     $this->view->assign('contentId', $this->ceData['uid']);
     // assign width and height of map
     if (0 < (int) $this->settings['cbgmMapWidth']) {
         $width = $this->settings['cbgmMapWidth'];
     } else {
         $width = $this->settings['display']['width'];
     }
     $this->view->assign('width', $width);
     if (0 < (int) $this->settings['cbgmMapHeight']) {
         $height = $this->settings['cbgmMapHeight'];
     } else {
         $height = $this->settings['display']['height'];
     }
     $this->view->assign('height', $height);
     // assign pin description text
     $infoText = $this->settings['cbgmDescription'];
     $this->view->assign('infoText', urlencode($infoText));
     // assign icon if given by constant and/or typoscript
     if (!empty($this->settings['display']['icon']) && file_exists(PATH_site . $this->settings['display']['icon'])) {
         $this->view->assign('icon', TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST') . '/' . $this->settings['display']['icon']);
     } else {
         $this->view->assign('icon', null);
     }
     // assign deactivation of zooming by mousewheel
     $this->view->assign('useScrollwheel', $this->settings['options']['useScrollwheel'] ? 'true' : 'false');
     // assign location (longitude and latitude) to the view
     $this->view->assign('latitude', (double) $this->settings['cbgmLatitude']);
     $this->view->assign('longitude', (double) $this->settings['cbgmLongitude']);
     // assign map zoom level to the view ,if given value is valid
     if (0 <= (int) $this->settings['cbgmScaleLevel'] && !empty($this->settings['cbgmScaleLevel'])) {
         $mapZoom = (int) $this->settings['cbgmScaleLevel'];
     } else {
         $mapZoom = $this->settings['display']['zoom'];
     }
     $this->view->assign('mapZoom', $mapZoom);
     // assign map type to the view, if given value is valid
     if (in_array((string) $this->settings['cbgmMapType'], preg_split("/[\\s]*[,][\\s]*/", $this->settings['valid']['mapTypes']))) {
         $mapType = $this->settings['cbgmMapType'];
     } else {
         $mapType = $this->settings['display']['mapType'];
     }
     $this->view->assign('mapType', $mapType);
     // assign navigation controls to the view
     if (in_array((string) $this->settings['cbgmNavigationControl'], preg_split("/[\\s]*[,][\\s]*/", $this->settings['valid']['navigationControl']))) {
         $navigationControl = $this->settings['cbgmNavigationControl'];
     } else {
         $navigationControl = $this->settings['display']['navigationControl'];
     }
     $this->view->assign('mapControl', $navigationControl);
     // assign map styling, if given
     $this->view->assign('mapStyling', null);
     if (!empty($this->settings['display']['mapStyling']) && file_exists(PATH_site . $this->settings['display']['mapStyling'])) {
         $styling = file_get_contents(PATH_site . $this->settings['display']['mapStyling']);
         if (!is_null(json_decode($styling))) {
             $this->view->assign('mapStyling', $styling);
         }
     } else {
         if (!empty($this->settings['display']['mapStyling']) && !is_null(json_decode($this->settings['display']['mapStyling']))) {
             $this->view->assign('mapStyling', $this->settings['display']['mapStyling']);
         }
     }
     $this->view->assign('braceStart', '{');
     $this->view->assign('braceEnd', '}');
     // assign auto open flag to the view
     $this->view->assign('openInfoBox', $this->settings['cbgmAutoOpen'] ? true : false);
 }
 /**
  * This function was called from indexer object and saves content to index table
  *
  * @return string content which will be displayed in backend
  */
 public function startIndexing()
 {
     $content = '';
     $table = 'tx_a21glossary_main';
     // get the pages from where to index the news
     $indexPids = $this->getPidList($this->indexerConfig['startingpoints_recursive'], $this->indexerConfig['sysfolder'], $table);
     // add the tags of the parent page
     if ($this->indexerConfig['index_use_page_tags']) {
         $this->pageRecords = $this->getPageRecords($indexPids);
         $this->addTagsToRecords($indexPids);
     }
     // get all the glossary records to index, don't index hidden or
     // deleted glossary records, BUT  get the records with frontend user group
     // access restrictions or time (start / stop) restrictions.
     // Copy those restrictions to the index.
     $fields = '*';
     $where = 'pid IN (' . implode(',', $indexPids) . ') ';
     $where .= TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table);
     $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where);
     $indexedRecordsCounter = 0;
     $resCount = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
     if ($resCount) {
         while ($record = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             // compile the information which should go into the index:
             // short, shortcut, longversion, shorttype, description, link
             $title = strip_tags($record['short']);
             $abstract = strip_tags($record['longversion']);
             $fullContent = strip_tags($record['shortcut'] . "\n" . $record['longversion'] . "\n" . $record['description'] . "\n" . $record['link']);
             // compile params for single view, example:
             // index.php?id=16&tx_a21glossary[uid]=71&cHash=9f9368211d8ae742a8d3ad29c4f0a308
             $paramsSingleView = array();
             $paramsSingleView['tx_a21glossary']['uid'] = $record['uid'];
             $params = rawurldecode('&' . http_build_query($paramsSingleView, NULL, '&'));
             // add tags from pages
             if ($this->indexerConfig['index_use_page_tags']) {
                 $tags = $this->pageRecords[intval($record['pid'])]['tags'];
             } else {
                 $tags = '';
             }
             // make it possible to modify the indexerConfig via hook
             $indexerConfig = $this->indexerConfig;
             // set additional fields
             $additionalFields = array();
             $additionalFields['orig_uid'] = $record['uid'];
             $additionalFields['orig_pid'] = $record['pid'];
             $additionalFields['sortdate'] = $record['crdate'];
             // hook for custom modifications of the indexed data, e.g. the tags
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifya21glossaryIndexEntry'])) {
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifya21glossaryIndexEntry'] as $_classRef) {
                     $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                     $_procObj->modifya21glossaryIndexEntry($title, $abstract, $fullContent, $params, $tags, $record, $additionalFields, $indexerConfig, $this);
                 }
             }
             // store this record to the index
             $this->pObj->storeInIndex($indexerConfig['storagepid'], $title, 'a21glossary', $indexerConfig['targetpid'], $fullContent, $tags, $params, $abstract, $record['sys_language_uid'], $record['starttime'], $record['endtime'], $record['fe_group'], false, $additionalFields);
             $indexedRecordsCounter++;
         }
         $content = '<p><b>Indexer "' . $this->indexerConfig['title'] . '":</b><br />' . "\n" . $indexedRecordsCounter . ' glossary records have been indexed.</p>' . "\n";
         $content .= $this->showErrors();
         $content .= $this->showTime();
     }
     return $content;
 }
 /**
  * get recursive DAM categories
  *
  * @param integer $catUid The category uid to search in recursive records
  * @param integer $depth Recursive depth. Normally you don't have to set it.
  * @return string A commaseperated list of category uids
  */
 public function getRecursiveDAMCategories($catUid, $depth = 0)
 {
     if ($catUid) {
         $enableFields = TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_dam_cat') . TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tx_dam_cat');
         $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('GROUP_CONCAT(uid) AS categoryUids', 'tx_dam_cat', 'parent_id = ' . intval($catUid) . $enableFields, '', '', '');
         // add categories to list
         $listOfCategories = $row['categoryUids'];
         $categories = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $row['categoryUids']);
         if (is_array($categories) && count($categories)) {
             foreach ($categories as $category) {
                 // only if further categories are found, add them to list
                 $tempCatList = $this->getRecursiveDAMCategories($category, $depth + 1);
                 $addCategory = count(TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $tempCatList, true));
                 if ($addCategory) {
                     $listOfCategories .= ',' . $tempCatList;
                 }
             }
         }
         return ($depth === 0 ? $catUid . ',' : '') . $listOfCategories;
     } else {
         return '';
     }
 }
 /**
  * This function was called from indexer object and saves content to index table
  *
  * @return string content which will be displayed in backend
  */
 public function startIndexing()
 {
     // get all address records from pid set in indexerConfig
     $fields = '*';
     $table = 'tt_address';
     $indexPids = $this->getPidList($this->indexerConfig['startingpoints_recursive'], $this->indexerConfig['sysfolder'], $table);
     if ($this->indexerConfig['index_use_page_tags']) {
         // add the tags of each page to the global page array
         $this->pageRecords = $this->getPageRecords($indexPids);
         $this->addTagsToRecords($indexPids);
     }
     $where = 'pid IN (' . implode(',', $indexPids) . ') ';
     if (TYPO3_VERSION_INTEGER >= 7000000) {
         $where .= TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table);
         $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
     } else {
         $where .= t3lib_befunc::BEenableFields($table);
         $where .= t3lib_befunc::deleteClause($table);
     }
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where);
     $resCount = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
     // no address records found
     if (!$resCount) {
         $content = '<p>No address records found!</p>';
         return $content;
     }
     // if records found: process them
     while ($addressRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $abstract = '';
         $content = '';
         // set title, use company if set, otherwise name
         $title = !empty($addressRow['company']) ? $addressRow['company'] : (!empty($addressRow['name']) ? $addressRow['name'] : $addressRow['first_name'] . ' ' . $addressRow['last_name']);
         // use description as abstract if set
         if (!empty($addressRow['description'])) {
             $abstract = $addressRow['description'];
         }
         // build content
         if (!empty($addressRow['company'])) {
             $content .= $addressRow['company'] . "\n";
         }
         if (!empty($addressRow['title'])) {
             $content .= $addressRow['title'] . ' ';
         }
         if (!empty($addressRow['name'])) {
             $content .= $addressRow['name'] . "\n";
             // name
         } else {
             if (!empty($addressRow['first_name'])) {
                 $content .= $addressRow['first_name'] . ' ';
             }
             if (!empty($addressRow['middle_name'])) {
                 $content .= $addressRow['middle_name'] . ' ';
             }
             if (!empty($addressRow['last_name'])) {
                 $content .= $addressRow['last_name'] . ' ';
             }
             if (!empty($addressRow['last_name']) || !empty($addressRow['middle_name']) || !empty($addressRow['middle_name'])) {
                 $content .= "\n";
             }
         }
         if (!empty($addressRow['address'])) {
             $content .= $addressRow['address'] . "\n";
         }
         if (!empty($addressRow['zip'])) {
             $content .= $addressRow['zip'] . "\n";
         }
         if (!empty($addressRow['city'])) {
             $content .= $addressRow['city'] . "\n";
         }
         if (!empty($addressRow['country'])) {
             $content .= $addressRow['country'] . "\n";
         }
         if (!empty($addressRow['region'])) {
             $content .= $addressRow['region'] . "\n";
         }
         if (!empty($addressRow['email'])) {
             $content .= $addressRow['email'] . "\n";
         }
         if (!empty($addressRow['phone'])) {
             $content .= $addressRow['phone'] . "\n";
         }
         if (!empty($addressRow['fax'])) {
             $content .= $addressRow['fax'] . "\n";
         }
         if (!empty($addressRow['mobile'])) {
             $content .= $addressRow['mobile'] . "\n";
         }
         if (!empty($addressRow['www'])) {
             $content .= $addressRow['www'];
         }
         // put content together
         $fullContent = $abstract . "\n" . $content;
         // there is no tt_address default param like this; you have to modify this by hook to fit your needs
         $params = '&tt_address[showUid]=' . $addressRow['uid'];
         // no tags yet
         if ($this->indexerConfig['index_use_page_tags']) {
             $tagContent = $this->pageRecords[intval($addressRow['pid'])]['tags'];
         } else {
             $tagContent = '';
         }
         // set additional fields for sorting
         $additionalFields = array('sortdate' => $addressRow['tstamp']);
         // fill orig_uid
         if (isset($addressRow['uid']) && $addressRow['uid'] > 0) {
             $additionalFields['orig_uid'] = $addressRow['uid'];
         }
         // fill orig_pid
         if (isset($addressRow['pid']) && $addressRow['pid'] > 0) {
             $additionalFields['orig_pid'] = $addressRow['pid'];
         }
         // make it possible to modify the indexerConfig via hook
         $indexerConfig = $this->indexerConfig;
         // add some fields which you may set in your own hook
         $customfields = array('sys_language_uid' => 0, 'starttime' => 0, 'endtime' => 0, 'fe_group' => '');
         // hook for custom modifications of the indexed data, e. g. the tags
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyAddressIndexEntry'])) {
             foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyAddressIndexEntry'] as $_classRef) {
                 if (TYPO3_VERSION_INTEGER >= 7000000) {
                     $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                 } else {
                     $_procObj =& t3lib_div::getUserObj($_classRef);
                 }
                 $_procObj->modifyAddressIndexEntry($title, $abstract, $fullContent, $params, $tagContent, $addressRow, $additionalFields, $indexerConfig, $customfields);
             }
         }
         // store in index
         $this->pObj->storeInIndex($indexerConfig['storagepid'], $title, 'tt_address', $indexerConfig['targetpid'], $fullContent, $tagContent, $params, $abstract, $customfields['sys_language_uid'], $customfields['starttime'], $customfields['endtime'], $customfields['fe_group'], false, $additionalFields);
     }
     $content = '<p><b>Indexer "' . $this->indexerConfig['title'] . '": ' . $resCount . ' address records have been indexed.</b></p>' . "\n";
     $content .= $this->showErrors();
     $content .= $this->showTime();
     return $content;
 }
 /**
  * compiles a list of filter options in order to display them to in plugin (pi1)
  * @param $config
  */
 function getListOfAvailableFilteroptionsForFlexforms(&$config)
 {
     if ($this->isTypo3LTS7()) {
         $parentRow = $config['flexParentDatabaseRow'];
     } else {
         $parentRow = $config['row'];
     }
     // get id from string
     if (strstr($parentRow['pages'], 'pages_')) {
         $intString = str_replace('pages_', '', $parentRow['pages']);
         $intString = substr($intString, 0, strpos($intString, '|'));
         $intString = intval($intString);
     } else {
         $intString = intval($parentRow['pages']);
     }
     // print message if no startingpoint is set in plugin config
     if (empty($intString)) {
         $config['items'][] = array('[SET STARTINGPOINT FIRST!]', '');
     }
     // get filters
     $fields = '*';
     $table = 'tx_kesearch_filters';
     $where = 'pid IN(' . $intString . ') ';
     $where .= BackendUtility::BEenableFields($table);
     $where .= BackendUtility::deleteClause($table);
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where);
     $count = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
     if ($count) {
         while ($rowFilter = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             if (!empty($rowFilter['options'])) {
                 // get filteroptions
                 $fieldsOpts = '*';
                 $tableOpts = 'tx_kesearch_filteroptions';
                 $whereOpts = 'uid in (' . $rowFilter['options'] . ')';
                 $whereOpts .= BackendUtility::BEenableFields($tableOpts);
                 $whereOpts .= BackendUtility::deleteClause($tableOpts);
                 $resOpts = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fieldsOpts, $tableOpts, $whereOpts);
                 while ($rowOpts = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resOpts)) {
                     $config['items'][] = array($rowFilter['title'] . ': ' . $rowOpts['title'], $rowOpts['uid']);
                 }
             }
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFilteroptionsForFlexforms'])) {
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFilteroptionsForFlexforms'] as $_classRef) {
                     $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                     $_procObj->modifyFilteroptionsForFlexforms($config, $rowFilter, $this);
                 }
             }
         }
     }
 }
 /**
  * add filter options (preselected by piVars)
  *
  * @param array $tagsAgainst
  */
 public function buildPiVarsTagsAgainst(array &$tagsAgainst)
 {
     // add filter options selected in the frontend
     $tagChar = $this->pObj->extConf['prePostTagChar'];
     if (is_array($this->pObj->piVars['filter'])) {
         foreach ($this->pObj->piVars['filter'] as $key => $tag) {
             if (is_array($this->pObj->piVars['filter'][$key])) {
                 foreach ($this->pObj->piVars['filter'][$key] as $subkey => $subtag) {
                     // Don't add the tag if it is already inserted by preselected filters
                     if (!empty($subtag) && strstr($tagsAgainst[$key], $subtag) === false) {
                         // Don't add a "+", because we are here in checkbox mode. It's a OR.
                         $tagsAgainst[$key] .= ' "' . $tagChar . $GLOBALS['TYPO3_DB']->quoteStr($subtag, 'tx_kesearch_index') . $tagChar . '"';
                     }
                 }
             } else {
                 // Don't add the tag if it is already inserted by preselected filters
                 if (!empty($tag) && strstr($tagsAgainst[$key], $subtag) === false) {
                     $tagsAgainst[$key] .= ' +"' . $tagChar . $GLOBALS['TYPO3_DB']->quoteStr($tag, 'tx_kesearch_index') . $tagChar . '"';
                 }
             }
         }
     }
     // hook for modifiying the tags to filter for
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyTagsAgainst'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyTagsAgainst'] as $_classRef) {
             $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             $_procObj->modifyTagsAgainst($tagsAgainst, $this);
         }
     }
 }
 /**
  * get Content of PDF file
  *
  * @param string $file
  * @return string The extracted content of the file
  */
 public function getContent($file)
 {
     $this->fileInfo = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_lib_fileinfo');
     $this->fileInfo->setFile($file);
     // get PDF informations
     if (!($pdfInfo = $this->getPdfInfo($file))) {
         return false;
     }
     // proceed only of there are any pages found
     if (intval($pdfInfo['pages']) && $this->isAppArraySet) {
         // create the tempfile which will contain the content
         $tempFileName = TYPO3\CMS\Core\Utility\GeneralUtility::tempnam('pdf_files-Indexer');
         // Delete if exists, just to be safe.
         @unlink($tempFileName);
         // generate and execute the pdftotext commandline tool
         $cmd = $this->app['pdftotext'] . ' -enc UTF-8 -q ' . escapeshellarg($file) . ' ' . escapeshellarg($tempFileName);
         TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd);
         // check if the tempFile was successfully created
         if (@is_file($tempFileName)) {
             $content = TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($tempFileName);
             unlink($tempFileName);
         } else {
             $this->addError('Content for file ' . $file . ' could not be extracted. Maybe it is encrypted?');
             // return empty string if no content was found
             $content = '';
         }
         return $this->removeEndJunk($content);
     } else {
         return false;
     }
 }
 /**
  * Get the result row with getProcessedValueExtra()
  * It allow you to respect the TCA rules
  *
  * @param  array  $row
  * @param  string $table
  * @return array
  */
 public static function getResultRow($row, $table)
 {
     $record = array();
     foreach ($row as $fieldName => $fieldValue) {
         if (TYPO3_MODE == 'FE') {
             // $GLOBALS['TSFE']->includeTCA();
             $GLOBALS['LANG'] = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Lang\\LanguageService');
             $GLOBALS['LANG']->init($GLOBALS['TSFE']->tmpl->setup['config.']['language']);
         }
         $record[$fieldName] = \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValueExtra($table, $fieldName, $fieldValue, 0, $row['uid']);
     }
     return $record;
 }
 /**
  * The main method of the PlugIn
  *
  * @param	string		$content: The PlugIn content
  * @param	array		$conf: The PlugIn configuration
  * @return	The content that is displayed on the website
  */
 function main($content, $conf)
 {
     $this->ms = TYPO3\CMS\Core\Utility\GeneralUtility::milliseconds();
     $this->conf = $conf;
     $this->pi_setPiVarDefaults();
     $this->pi_loadLL();
     $this->pi_USER_INT_obj = 1;
     // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
     // initializes plugin configuration
     $this->init();
     // init XAJAX?
     if ($this->conf['renderMethod'] != 'static') {
         $xajaxIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('xajax');
         if (!$xajaxIsLoaded) {
             return '<span style="color: red;"><b>ke_search error:</b>"XAJAX" must be installed for this mode.</span>';
         } else {
             $this->initXajax();
         }
     }
     // hook for initials
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'] as $_classRef) {
             $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             $_procObj->addInitials($this);
         }
     }
     // get templates
     $template['multiselect'] = $this->cObj->getSubpart($this->templateCode, '###SUB_FILTER_MULTISELECT###');
     $template['multihidden'] = $this->cObj->getSubpart($template['multiselect'], '###SUB_FILTER_MULTISELECT_HIDDEN###');
     $template['multifilter'] = $this->cObj->getSubpart($template['multiselect'], '###SUB_FILTER_MULTISELECT_FILTER###');
     $template['multioption'] = $this->cObj->getSubpart($template['multifilter'], '###SUB_FILTER_MULTISELECT_OPTION###');
     // get current filter
     $filters = $this->filters->getFilters();
     foreach ($filters as $filter) {
         if ($filter['target_pid'] == intval($GLOBALS['TSFE']->id)) {
             break;
         }
     }
     // hook for modifying content
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyMultiselectContent'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyMultiselectContent'] as $_classRef) {
             $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
             $content = $_procObj->modifyMultiselectContent($template['multiselect'], $filter, $this);
         }
     }
     if (is_array($filter) && count($filter)) {
         $contentOptions = '';
         $optionsAmountArray = $GLOBALS['TSFE']->fe_user->getKey('ses', 'ke_search.tagsInSearchResults');
         $countLoops = 1;
         if (is_array($this->piVars['filter'][$filter['uid']]) && count($this->piVars['filter'][$filter['uid']])) {
             $this->piVars['filter'][$filter['uid']] = array_unique($this->piVars['filter'][$filter['uid']]);
         }
         foreach ($filter['options'] as $optionKey => $option) {
             $option['title'] = htmlspecialchars($option['title']);
             $option['tag'] = htmlspecialchars($option['tag']);
             if ($optionsAmountArray[$option['tag']]) {
                 $optionCounter = $optionsAmountArray[$option['tag']];
             } else {
                 $optionCounter = 0;
             }
             $selected = $this->piVars['filter'][$filter['uid']][$optionKey] ? 'checked="checked"' : '';
             $markerArray['###ADDCLASS###'] = $countLoops % 3 ? '' : ' last';
             $markerArray['###FILTERNAME###'] = 'tx_kesearch_pi1[filter][' . $filter['uid'] . ']';
             $markerArray['###OPTIONID###'] = $option['uid'];
             $markerArray['###OPTIONKEY###'] = $optionKey;
             $markerArray['###OPTIONTITLE###'] = $option['title'] . ' (' . $optionCounter . ')';
             $markerArray['###OPTIONTAG###'] = $option['tag'];
             $markerArray['###SELECTED###'] = $selected;
             $countLoops++;
             $contentOptions .= $this->cObj->substituteMarkerArray($template['multioption'], $markerArray);
         }
         $content .= $this->cObj->substituteSubpart($template['multifilter'], '###SUB_FILTER_MULTISELECT_OPTION###', $contentOptions);
         $content = $this->cObj->substituteMarker($content, '###TITLE###', $filter['title']);
     }
     $content = $this->cObj->substituteSubpart($template['multiselect'], '###SUB_FILTER_MULTISELECT_FILTER###', $content);
     $content = $this->cObj->substituteMarker($content, '###FORM_ACTION###', $this->pi_getPageLink($this->conf['resultPage']));
     $content = $this->cObj->substituteMarker($content, '###SHOW_RESULTS###', $this->pi_getLL('show_results'));
     $content = $this->cObj->substituteMarker($content, '###LINK_BACK###', $this->cObj->typoLink($this->pi_getLL('back'), array('parameter' => $this->conf['resultPage'], 'addQueryString' => 1, 'addQueryString.' => array('exclude' => 'id'))));
     if (is_array($this->piVars['filter']) && count($this->piVars['filter'])) {
         foreach ($this->piVars['filter'] as $filterKey => $filterValue) {
             if ($filterKey == $filter['uid']) {
                 continue;
             }
             foreach ($this->piVars['filter'][$filterKey] as $optionKey => $option) {
                 $hidden .= $this->cObj->substituteMarker($template['multihidden'], '###NAME###', 'tx_kesearch_pi1[filter][' . $filterKey . '][' . $optionKey . ']');
                 $hidden = $this->cObj->substituteMarker($hidden, '###VALUE###', $option);
             }
         }
     }
     $content = $this->cObj->substituteSubpart($content, '###SUB_FILTER_MULTISELECT_HIDDEN###', $hidden);
     $content = $this->cObj->substituteMarker($content, '###PAGEID###', $this->conf['resultPage']);
     $content = $this->cObj->substituteMarker($content, '###SWORD###', htmlspecialchars($this->piVars['sword']));
     return $this->pi_wrapInBaseClass($content);
 }