CBitrixXscanHtaccess::Search

  1. Bitrix24 API (v. 23.675.0)
  2. security
  3. CBitrixXscanHtaccess
  4. Search
  • Модуль: security
  • Путь к файлу: ~/bitrix/modules/security/classes/general/xscan_htaccess.php
  • Класс: CBitrixXscanHtaccess
  • Вызов: CBitrixXscanHtaccess::Search
function Search($path)
{
	$path = str_replace('\', '/', $path);
	do
	{
		$path = str_replace('//', '/', $path, $flag);
	}
	while ($flag);

	if ($this->start_time && time() - $this->start_time > $this->time_limit)
	{
		if (!$this->break_point)
		{
			$this->break_point = $path;
		}
		return;
	}

	if ($this->skip_path && !$this->found)
	{
		if (strpos($this->skip_path, dirname($path)) !== 0)
		{
			return;
		}

		if ($this->skip_path == $path)
		{
			$this->found = true;
		}
	}

	if (is_dir($path)) // dir
	{
		$p = realpath($path);

		if (is_link($path))
		{
			$d = dirname($path);
			if (strpos($p, $d) !== false || strpos($d, $p) !== false)
			{
				return true;
			}
		}

		$dir = opendir($path);

		while ($item = readdir($dir))
		{
			if ($item == '.' || $item == '..')
			{
				continue;
			}

			$this->Search($path . '/' . $item);
		}
		closedir($dir);
	}
	elseif (preg_match('/.htaccess$/', $path))
	{
		if (!$this->skip_path || $this->found)
		{
			$this->result[] = $path;
		}
	}
}

Добавить комментарий