• Модуль: security
  • Путь к файлу: ~/bitrix/modules/security/classes/general/tests/environment.php
  • Класс: CSecurityEnvironmentTest
  • Вызов: CSecurityEnvironmentTest::isHtaccessOverrided
protected function isHtaccessOverrided()
{
	$uploadDir = self::getUploadDir();
	$uploadPathTestFile = $uploadDir.'test/test.php';
	$uploadPathHtaccessFile = $uploadDir.'test/.htaccess';
	$uploadPathTestUri = $uploadDir.'test/test_notexist.php';

	if(!CheckDirPath($_SERVER['DOCUMENT_ROOT'].$uploadPathTestFile))
		return false;

	$testingText = "testing text here...";
	$htaccessText = <<
RewriteEngine Off

HTACCESS;

	$result = false;
	if(file_put_contents($_SERVER['DOCUMENT_ROOT'].$uploadPathTestFile, $testingText))
	{
		if(file_put_contents($_SERVER['DOCUMENT_ROOT'].$uploadPathHtaccessFile, $htaccessText))
		{
			$response = self::doRequestToLocalhost($uploadPathTestUri);
			if($response && $response == $testingText)
			{
				$result = true;
			}
			unlink($_SERVER['DOCUMENT_ROOT'].$uploadPathHtaccessFile);
		}
		unlink($_SERVER['DOCUMENT_ROOT'].$uploadPathTestFile);
	}
	return $result;
}