• Модуль: fileman
  • Путь к файлу: ~/bitrix/modules/fileman/classes/general/fileman_utils.php
  • Класс: CFilemanSearch
  • Вызов: CFilemanSearch::Init
public function Init($Params)
{
	$this->maxFileOpenSize = 1024 * COption::GetOptionString("fileman", "search_max_open_file_size", 1024);
	$this->maxResultCount = COption::GetOptionString("fileman", "search_max_res_count", false);

	$this->startTime = time();
	$this->Params = $Params;
	$this->Result = array();
	$this->docRoot = CSite::GetSiteDocRoot($Params['site']);

	$this->bSkip = $this->Params['lastPath'] ? true : false;
	if ($this->bSkip)
	{
		$this->Params['lastPath'] = Rel2Abs("/", $this->Params['lastPath']);
		$this->Params['lastPath'] = $this->docRoot.$this->Params['lastPath'];
	}

	$this->sSess = $this->Params['ssess'] ? $this->Params['ssess'] : false;
	$this->bReplace = $this->Params['bReplace'] && $this->Params['phrase'] <> '';

	if ($this->bReplace)
	{
		$this->Params['bDirsToo'] = false;
	}

	$bSuccess = false;
	$bBreak = false;
	$nextPath = '';

	// Search in results of the previous search
	if ($this->Params['bInResult'])
	{
		$searchRes = CFilemanSearch::GetSearchResult($this->Params['ssess'], array('id', 'asc'));
		for($i = 0, $l = count($searchRes); $i < $l; $i++)
		{
			$path = $this->docRoot.$searchRes[$i]['path'];
			if ($this->CheckBreak())
			{
				$bBreak = true;
				$nextPath = $path;
				break;
			}
			else
			{
				$this->Search($path);
			}
		}
		$bSuccess = true;
		$bStoped = false;
	}
	else
	{
		$path = Rel2Abs("/", $this->Params["dir"]);
		$path = $this->docRoot.$path;
		$oDir = new CFilemanUtilDir($path, array(
			'obj' => $this,
			'site' => $Params['site'],
			'callBack' => "Search",
			'checkBreak' => "CheckBreak",
			'checkSubdirs' => $this->Params["bSubdir"]
		));
		$bSuccess = $oDir->Start();

		$bBreak = $oDir->bBreak;
		$nextPath = $oDir->nextPath;
		$bStoped = $oDir->bStoped;

		if ($bStoped)
			$bBreak = false;
	}

	if ($bSuccess)
	{
?>