예제 #1
0
function __checkForum($forumID)
{
    if (!($settingsForumID = COption::GetOptionString("tasks", "task_forum_id"))) {
        if ((int) $forumID > 0) {
            COption::SetOptionString("tasks", "task_forum_id", intval($forumID));
        }
    }
    if (IsModuleInstalled('extranet')) {
        if (-1 === COption::GetOptionString('tasks', 'task_extranet_forum_id', -1, $siteId = '')) {
            try {
                $extranetForumID = CTasksTools::GetForumIdForExtranet();
                COption::SetOptionString('tasks', 'task_extranet_forum_id', $extranetForumID, '', $siteId = '');
            } catch (TasksException $e) {
                COption::SetOptionString('tasks', 'task_extranet_forum_id', (int) $forumID, '', $siteId = '');
            }
        }
    }
    if (CModule::IncludeModule("forum") && $forumID && COption::GetOptionString("tasks", "forum_checked", false)) {
        $arGroups = array();
        $rs = CGroup::GetList($order = 'id', $by = 'asc', array());
        while ($ar = $rs->Fetch()) {
            $arGroups[$ar['ID']] = 'A';
        }
        CForumNew::Update($forumID, array("GROUP_ID" => $arGroups, "INDEXATION" => "Y"));
        COption::RemoveOption("tasks", "forum_checked");
    }
}