• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/cache_files_cleaner.php
  • Класс: CFileCacheCleaner
  • Вызов: CFileCacheCleaner::InitPath
function InitPath($PathToCheck)
{
	if($PathToCheck <> '')
	{
		$PathToCheck = preg_replace("#[\\\/]+#", "/", "/".$PathToCheck);
		//Check if path does not contain any injection
		if(preg_match('#/\.\.#', $PathToCheck) || preg_match('#\.\./#', $PathToCheck))
			return false;

		$base = "";
		foreach($this->_arPath as $path)
		{
			if(preg_match('#^'.$path.'#', $PathToCheck))
			{
				$base = $path;
				break;
			}
		}

		if($base <> '')
		{
			$this->_CurrentBase = $base;
			$this->_CurrentPath = mb_substr($PathToCheck, mb_strlen($base));
			return true;
		}
		else
		{
			return false;
		}
	}
	else
	{
		$this->_CurrentBase = $this->_arPath[0];
		$this->_CurrentPath = "";
		return true;
	}
}