• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/iblock.php
  • Класс: CWebDavIblock
  • Вызов: CWebDavIblock::_check_iblock_prop
function _check_iblock_prop($arProperty = false)
{
	static $dataType = 'IblockProperties';
	$checked = $this->_dataCache($dataType);

	if (!$checked)
	{
		$arProps = $this->GetProperties();

		foreach ($arProps as $code => &$arIBProp)
		{
			if (!isset($arProperty[$code]))
				continue;

			if (($arIBProp['PROPERTY_TYPE'] != $arProperty[$code]['type']) || ($arIBProp['USER_TYPE'] != null))
				continue;

			unset($arProperty[$code]);
		}

		$prp = new CIBlockProperty();

		foreach ($arProperty as $sPropertyCode => $arPropertyParams)
		{
			$properties = array(
				"IBLOCK_ID" => $this->IBLOCK_ID,
				"ACTIVE" => "Y",
				"CODE" => $sPropertyCode,
				"MULTIPLE" => "N",
				"PROPERTY_TYPE" => $arPropertyParams["type"],
				"NAME" => $arPropertyParams["name"]);

			if (isset($arPropertyParams["properties"]))
				$properties+=$arPropertyParams["properties"];

			$res = $prp->Add($properties);
		}

		if (($this->FORUM_ID !== null) && empty($this->arRootSection) && CModule::IncludeModule('forum'))
		{
			$arForum = CForumNew::GetByID($this->FORUM_ID);
			if ($arForum['ACTIVE'] == 'Y')
			{
				$arSites = CForumNew::GetSites($this->FORUM_ID);
				foreach ($arSites as $siteID => $forumUrl)
				{
					if (mb_strpos($forumUrl, '/community/forum/') === 0)
					{
						$arSites[$siteID] = str_replace(array('///', '//'), '/', $this->base_url . "/element/comment/#TOPIC_ID#/#MESSAGE_ID#/");
					}
				}

				$arUpForum = array();
				$arUpForum["SITES"] = $arSites;
				CForumNew::Update($this->FORUM_ID, $arUpForum);
			}
		}

		$this->_dataCache($dataType, true);
	}
}