function Update($ID, $arFields) { global $DB; $ID = intVal($ID); if ($ID <= 0) { return false; } if (!CForumGroup::CheckFields("UPDATE", $arFields, $ID)) { return false; } if (CACHED_b_forum_group !== false) { $GLOBALS["CACHE_MANAGER"]->CleanDir("b_forum_group"); } /***************** Event onBeforeGroupForumsUpdate *****************/ foreach (GetModuleEvents("forum", "onBeforeGroupForumsUpdate", true) as $arEvent) { if (ExecuteModuleEventEx($arEvent, array(&$ID, &$arFields)) === false) { return false; } } /***************** /Event ******************************************/ if (empty($arFields)) { return false; } $strUpdate = $DB->PrepareUpdate("b_forum_group", $arFields); if (!empty($strUpdate)) { $strSql = "UPDATE b_forum_group SET " . $strUpdate . " WHERE ID = " . $ID; $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__); } if (is_set($arFields, "LANG")) { $DB->Query("DELETE FROM b_forum_group_lang WHERE FORUM_GROUP_ID = " . $ID, false, "File: " . __FILE__ . "<br>Line: " . __LINE__); for ($i = 0; $i < count($arFields["LANG"]); $i++) { $arInsert = $DB->PrepareInsert("b_forum_group_lang", $arFields["LANG"][$i]); $strSql = "INSERT INTO b_forum_group_lang(FORUM_GROUP_ID, " . $arInsert[0] . ") VALUES(" . $ID . ", " . $arInsert[1] . ")"; $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__); } } CForumGroup::Resort(); /***************** Event onAfterGroupForumsUpdate *****************/ foreach (GetModuleEvents("forum", "onAfterGroupForumsUpdate", true) as $arEvent) { ExecuteModuleEventEx($arEvent, array($ID, $arFields)); } /***************** /Event ******************************************/ return $ID; }