t3lib_search_livesearch.patch

Peter Russ, 2012-03-15 15:41

Download (3.19 KB)

View differences:

t3lib/search/class.t3lib_search_livesearch.php (revision )
119 119
		$recordArray = array();
120 120
		$pageList = array();
121 121
		$mounts = $GLOBALS['BE_USER']->returnWebmounts();
122
/**
123
 * COREPATCH Telekom
124
 * by Peter Russ <peter.russ@telekom.de>
125
 * 14.03.12: fixed weird programming
126
 *
127
 */
128
		$pageIdList = array();
122 129
		foreach ($mounts as $pageId) {
123
			$pageList[] = $this->getAvailablePageIds($pageId, self::RECURSIVE_PAGE_LEVEL);
130
			if (!in_array($pageId, $pageIdList)) {
131
				$pageList = $this->getAvailablePageIds($pageId, self::RECURSIVE_PAGE_LEVEL);
132
				$pageIdList = array_merge($pageIdList, $pageList);
124
		}
133
			}
125
		$pageIdList = implode(',', array_unique(explode(',', implode(',', $pageList))));
126
		unset($pageList);
134
		}
135
		$pageIdList = implode(',', $pageIdList);
136

  
137
/**
138
 * end COREPATCH
139
 */		unset($pageList);
127 140
		$limit = $this->startCount . ',' . $this->limitCount;
128 141

  
129 142
		if ($this->queryParser->isValidCommand($searchQuery)) {
......
241 254
			'LIMIT' => $limit
242 255
		);
243 256
		$result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
244
		$dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
245 257

  
246 258
		while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
247 259
			$collect[] = array(
......
478 490
	 * @param	integer		Page id.
479 491
	 * @param	integer		Depth to go down.
480 492
	 *
481
	 * @return	string		coma separated list of uids
493
	 * @return	array	coma separated list of uids
482 494
	 */
483 495
	protected function getAvailablePageIds($id, $depth) {
484
		$idList = '';
496
/**
497
 * COREPATCH Telekom
498
 * by Peter Russ <peter.russ@telekom.de>
499
 * 14.03.12: added hook and imrpoved handling due to problems with be_acl
500
 *
501
 */
502
		if (!$GLOBALS['BE_USER']->isAdmin() && isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/search/class.t3lib_search_livesearch.php']['getAvailablePageIds']) &&
503
			is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/search/class.t3lib_search_livesearch.php']['getAvailablePageIds'])) {
504
			$ids = array();
505
			foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/search/class.t3lib_search_livesearch.php']['getAvailablePageIds'] as $_funcRef) {
506
				$_params = array('currentIds' => $ids, 'perms' => 1);
507
				$ids = t3lib_div::callUserFunction($_funcRef, $_params, $this);
508
			}
509
			return $ids;
510
		} else {
511
			/** @var t3lib_pageTree $tree*/
485
		$tree = t3lib_div::makeInstance('t3lib_pageTree');
486
		$tree->init('AND ' . $this->userPermissions);
487
		$tree->makeHTML = 0;
488
		$tree->fieldArray = array('uid', 'php_tree_stop');
489
		if ($depth) {
490
			$tree->getTree($id, $depth, '');
491
		}
492
		$tree->ids[] = $id;
512
			$tree = t3lib_div::makeInstance('t3lib_pageTree');
513
			$tree->init('AND ' . $this->userPermissions);
514
			$tree->makeHTML = 0;
515
			$tree->fieldArray = array('uid', 'php_tree_stop');
516
			if ($depth) {
517
				$tree->getTree($id, $depth, '');
518
			}
519
			$tree->ids[] = $id;
493
		$idList = implode(',', $tree->ids);
494
		return $idList;
520
			return $tree->ids;
495
	}
521
		}
522

  
523
/**
524
 * end COREPATCH
525
 */	}
526

  
496 527
}
497 528

  
498 529
?>