function GetForumsList() { $arGroup = array(); $arForum = array(); $db_res = CForumGroup::GetListEx(array(), array("LID" => LANG)); if ($db_res && ($res = $db_res->GetNext())) { do { $arGroup[intVal($res["ID"])] = $res["~NAME"]; } while ($res = $db_res->GetNext()); } $db_res = CForumNew::GetListEx(array("FORUM_GROUP_SORT" => "ASC", "FORUM_GROUP_ID" => "ASC", "SORT" => "ASC", "NAME" => "ASC"), array()); if ($db_res && ($res = $db_res->GetNext())) { do { $arForum[intVal($res["ID"])] = $res["~NAME"]; if (intVal($res["FORUM_GROUP_ID"]) > 0 && array_key_exists($res["FORUM_GROUP_ID"], $arGroup)) { $arForum[intVal($res["ID"])] .= " [" . $arGroup[$res["FORUM_GROUP_ID"]] . "]"; } if ($res["ACTIVE"] != "Y") { $arForum[intVal($res["ID"])] .= " N/A"; } } while ($res = $db_res->GetNext()); } return $arForum; }
$date = @filemtime($sTemplateDirFull . "styles/additional.css"); $GLOBALS['APPLICATION']->SetAdditionalCSS($sTemplateDir . 'styles/additional.css?' . $date); $GLOBALS['APPLICATION']->AddHeadScript("/bitrix/js/main/utils.js"); $GLOBALS['APPLICATION']->AddHeadScript("/bitrix/components/bitrix/forum.interface/templates/.default/script.js"); $file = trim(preg_replace("'[\\\\/]+'", "/", dirname(__FILE__) . "/lang/" . LANGUAGE_ID . "/result_modifier.php")); if (!file_exists($file)) { $file = trim(preg_replace("'[\\\\/]+'", "/", dirname(__FILE__) . "/lang/en/result_modifier.php")); } if (file_exists($file)) { global $MESS; include_once $file; } $arResult["GROUPS"] = array(); if ($arParams["SHOW_FORUMS"] == "Y" && in_array($this->__page, array("forums", "list", "read"))) { CModule::IncludeModule("forum"); $arResult["GROUPS"] = CForumGroup::GetByLang(LANGUAGE_ID); if (!function_exists("__array_merge")) { function __array_merge($arr1, $arr2, $deep = false) { $arResult = $arr1; static $ii = 0; $ii++; $deep = $deep == false ? 0 : $deep; foreach ($arr2 as $key2 => $val2) { if (!array_key_exists($key2, $arResult)) { $arResult[$key2] = $val2; continue; } elseif ($val2 == $arResult[$key2]) { continue; } elseif (!is_array($arResult[$key2])) { $arResult[$key2] = array($arResult[$key2]);
if ($arExistsGroup["NAME"] == GetMessage($xmlID . "_GROUP_NAME")) { $arGroupID[$xmlID] = $arExistsGroup["ID"]; } } } $sort = 1; foreach ($arGroupID as $xmlID => $groupID) { if ($groupID > 0) { continue; } $arNewGroup = array("SORT" => $sort++, "LANG" => array()); foreach ($arLanguages as $languageID) { $arMessages = WizardServices::IncludeServiceLang("index.php", $languageID, $bReturnArray = true); $arNewGroup["LANG"][] = array("LID" => $languageID, "NAME" => array_key_exists($xmlID . "_GROUP_NAME", $arMessages) ? $arMessages[$xmlID . "_GROUP_NAME"] : GetMessage($xmlID . "_GROUP_NAME"), "DESCRIPTION" => array_key_exists($xmlID . "_GROUP_DESCRIPTION", $arMessages) ? $arMessages[$xmlID . "_GROUP_DESCRIPTION"] : GetMessage($xmlID . "_GROUP_DESCRIPTION")); } $arGroupID[$xmlID] = CForumGroup::Add($arNewGroup); } $rsUser = CUser::GetByID(1); if ($arUser = $rsUser->Fetch()) { $userName = $arUser["NAME"] . (strlen($arUser["NAME"]) <= 0 || strlen($arUser["LAST_NAME"]) <= 0 ? "" : " ") . $arUser["LAST_NAME"]; $authorName = strlen(trim($userName)) > 0 ? $userName : $arUser["LOGIN"]; } else { $authorName = "admin"; } $arForums = array(array("XML_ID" => "NEWS_COMMENTS", "NAME" => GetMessage("NEWS_COMMENTS_FORUM_NAME"), "DESCRIPTION" => GetMessage("NEWS_COMMENTS_FORUM_DESCRIPTION"), "SORT" => 2, "ACTIVE" => "Y", "ALLOW_HTML" => "N", "ALLOW_ANCHOR" => "Y", "ALLOW_BIU" => "Y", "ALLOW_IMG" => "Y", "ALLOW_LIST" => "Y", "ALLOW_QUOTE" => "Y", "ALLOW_CODE" => "Y", "ALLOW_FONT" => "Y", "ALLOW_SMILES" => "Y", "ALLOW_UPLOAD" => "Y", "ALLOW_NL2BR" => "N", "MODERATION" => "N", "ALLOW_MOVE_TOPIC" => "Y", "ORDER_BY" => "P", "DEDUPLICATION" => "N", "ORDER_DIRECTION" => "DESC", "LID" => LANGUAGE_ID, "PATH2FORUM_MESSAGE" => "", "ALLOW_UPLOAD_EXT" => "", "FORUM_GROUP_ID" => $arGroupID["COMMENTS"], "ASK_GUEST_EMAIL" => "N", "USE_CAPTCHA" => "N", "SITES" => array(WIZARD_SITE_ID => WIZARD_SITE_DIR . "community/forum/messages/forum#FORUM_ID#/topic#TOPIC_ID#/message#MESSAGE_ID#/#message#MESSAGE_ID#"), "EVENT1" => "forum", "EVENT2" => "message", "EVENT3" => "", "GROUP_ID" => array("2" => "M", WIZARD_PORTAL_ADMINISTRATION_GROUP => "Y")), array("XML_ID" => "PHOTOGALLERY_COMMENTS", "NAME" => GetMessage("PHOTOGALLERY_COMMENTS_FORUM_NAME"), "DESCRIPTION" => GetMessage("PHOTOGALLERY_COMMENTS_FORUM_DESCRIPTION"), "SORT" => 3, "ACTIVE" => "Y", "ALLOW_HTML" => "N", "ALLOW_ANCHOR" => "Y", "ALLOW_BIU" => "Y", "ALLOW_IMG" => "Y", "ALLOW_LIST" => "Y", "ALLOW_QUOTE" => "Y", "ALLOW_CODE" => "Y", "ALLOW_FONT" => "Y", "ALLOW_SMILES" => "Y", "ALLOW_UPLOAD" => "Y", "ALLOW_NL2BR" => "N", "MODERATION" => "N", "ALLOW_MOVE_TOPIC" => "Y", "ORDER_BY" => "P", "ORDER_DIRECTION" => "DESC", "LID" => LANGUAGE_ID, "PATH2FORUM_MESSAGE" => "", "ALLOW_UPLOAD_EXT" => "", "DEDUPLICATION" => "N", "FORUM_GROUP_ID" => $arGroupID["HIDDEN"], "ASK_GUEST_EMAIL" => "N", "USE_CAPTCHA" => "N", "SITES" => array(WIZARD_SITE_ID => WIZARD_SITE_DIR . "community/forum/messages/forum#FORUM_ID#/topic#TOPIC_ID#/message#MESSAGE_ID#/#message#MESSAGE_ID#"), "EVENT1" => "forum", "EVENT2" => "message", "EVENT3" => "", "GROUP_ID" => array("2" => "M", WIZARD_PORTAL_ADMINISTRATION_GROUP => "Y")), array("XML_ID" => "USERS_AND_GROUPS", "NAME" => GetMessage("USERS_AND_GROUPS_FORUM_NAME"), "DESCRIPTION" => GetMessage("USERS_AND_GROUPS_FORUM_DESCRIPTION"), "SORT" => 4, "ACTIVE" => "Y", "ALLOW_HTML" => "N", "ALLOW_ANCHOR" => "Y", "ALLOW_BIU" => "Y", "ALLOW_IMG" => "Y", "ALLOW_LIST" => "Y", "ALLOW_QUOTE" => "Y", "ALLOW_CODE" => "Y", "ALLOW_FONT" => "Y", "ALLOW_SMILES" => "Y", "ALLOW_UPLOAD" => "A", "ALLOW_NL2BR" => "N", "MODERATION" => "N", "ALLOW_MOVE_TOPIC" => "Y", "ORDER_BY" => "P", "DEDUPLICATION" => "N", "ORDER_DIRECTION" => "DESC", "LID" => LANGUAGE_ID, "PATH2FORUM_MESSAGE" => "", "ALLOW_UPLOAD_EXT" => "", "FORUM_GROUP_ID" => $arGroupID["HIDDEN"], "ASK_GUEST_EMAIL" => "N", "USE_CAPTCHA" => "N", "SITES" => array(WIZARD_SITE_ID => WIZARD_SITE_DIR . "community/forum/messages/forum#FORUM_ID#/topic#TOPIC_ID#/message#MESSAGE_ID#/#message#MESSAGE_ID#"), "EVENT1" => "forum", "EVENT2" => "message", "EVENT3" => "", "GROUP_ID" => array(WIZARD_PORTAL_ADMINISTRATION_GROUP => "Y")), array("XML_ID" => "DOCS_SHARED_COMMENTS", "NAME" => GetMessage("DOCS_SHARED_COMMENTS_NAME"), "DESCRIPTION" => GetMessage("DOCS_SHARED_COMMENTS_DECRIPTION"), "SORT" => 5, "ACTIVE" => "Y", "ALLOW_HTML" => "N", "ALLOW_ANCHOR" => "Y", "ALLOW_BIU" => "Y", "ALLOW_IMG" => "Y", "ALLOW_LIST" => "Y", "ALLOW_QUOTE" => "Y", "ALLOW_CODE" => "Y", "ALLOW_FONT" => "Y", "ALLOW_SMILES" => "Y", "ALLOW_UPLOAD" => "Y", "ALLOW_NL2BR" => "N", "MODERATION" => "N", "DEDUPLICATION" => "N", "ALLOW_MOVE_TOPIC" => "Y", "ORDER_BY" => "P", "ORDER_DIRECTION" => "DESC", "LID" => LANGUAGE_ID, "PATH2FORUM_MESSAGE" => "", "ALLOW_UPLOAD_EXT" => "", "FORUM_GROUP_ID" => $arGroupID["HIDDEN"], "ASK_GUEST_EMAIL" => "N", "USE_CAPTCHA" => "N", "SITES" => array(WIZARD_SITE_ID => WIZARD_SITE_DIR . "community/forum/messages/forum#FORUM_ID#/topic#TOPIC_ID#/message#MESSAGE_ID#/#message#MESSAGE_ID#"), "EVENT1" => "forum", "EVENT2" => "message", "EVENT3" => "", "GROUP_ID" => array("2" => "M", WIZARD_PORTAL_ADMINISTRATION_GROUP => "Y")), array("XML_ID" => "DOCS_SALES_COMMENTS", "NAME" => GetMessage("DOCS_SALES_COMMENTS_NAME"), "DESCRIPTION" => GetMessage("DOCS_SALES_COMMENTS_DECRIPTION"), "SORT" => 6, "ACTIVE" => "Y", "ALLOW_HTML" => "N", "ALLOW_ANCHOR" => "Y", "ALLOW_BIU" => "Y", "ALLOW_IMG" => "Y", "ALLOW_LIST" => "Y", "ALLOW_QUOTE" => "Y", "ALLOW_CODE" => "Y", "ALLOW_FONT" => "Y", "ALLOW_SMILES" => "Y", "ALLOW_UPLOAD" => "Y", "ALLOW_NL2BR" => "N", "MODERATION" => "N", "DEDUPLICATION" => "N", "ALLOW_MOVE_TOPIC" => "Y", "ORDER_BY" => "P", "ORDER_DIRECTION" => "DESC", "LID" => LANGUAGE_ID, "PATH2FORUM_MESSAGE" => "", "ALLOW_UPLOAD_EXT" => "", "FORUM_GROUP_ID" => $arGroupID["HIDDEN"], "ASK_GUEST_EMAIL" => "N", "USE_CAPTCHA" => "N", "SITES" => array(WIZARD_SITE_ID => WIZARD_SITE_DIR . "community/forum/messages/forum#FORUM_ID#/topic#TOPIC_ID#/message#MESSAGE_ID#/#message#MESSAGE_ID#"), "EVENT1" => "forum", "EVENT2" => "message", "EVENT3" => "", "GROUP_ID" => array("2" => "A", WIZARD_PORTAL_ADMINISTRATION_GROUP => "Y", WIZARD_EMPLOYEES_GROUP => "M", WIZARD_MARKETING_AND_SALES_GROUP => "M")), array("XML_ID" => "DOCS_DIRECTORS_COMMENTS", "NAME" => GetMessage("DOCS_DIRECTORS_COMMENTS_NAME"), "DESCRIPTION" => GetMessage("DOCS_DIRECTORS_COMMENTS_DECRIPTION"), "SORT" => 6, "ACTIVE" => "Y", "ALLOW_HTML" => "N", "ALLOW_ANCHOR" => "Y", "ALLOW_BIU" => "Y", "ALLOW_IMG" => "Y", "ALLOW_LIST" => "Y", "ALLOW_QUOTE" => "Y", "ALLOW_CODE" => "Y", "ALLOW_FONT" => "Y", "ALLOW_SMILES" => "Y", "ALLOW_UPLOAD" => "Y", "ALLOW_NL2BR" => "N", "MODERATION" => "N", "DEDUPLICATION" => "N", "ALLOW_MOVE_TOPIC" => "Y", "ORDER_BY" => "P", "ORDER_DIRECTION" => "DESC", "LID" => LANGUAGE_ID, "PATH2FORUM_MESSAGE" => "", "ALLOW_UPLOAD_EXT" => "", "FORUM_GROUP_ID" => $arGroupID["HIDDEN"], "ASK_GUEST_EMAIL" => "N", "USE_CAPTCHA" => "N", "SITES" => array(WIZARD_SITE_ID => WIZARD_SITE_DIR . "community/forum/messages/forum#FORUM_ID#/topic#TOPIC_ID#/message#MESSAGE_ID#/#message#MESSAGE_ID#"), "EVENT1" => "forum", "EVENT2" => "message", "EVENT3" => "", "GROUP_ID" => array("2" => "A", WIZARD_PORTAL_ADMINISTRATION_GROUP => "Y", WIZARD_DIRECTION_GROUP => "M")), array("XML_ID" => "GROUPS_AND_USERS_FILES_COMMENTS", "NAME" => GetMessage("GROUPS_AND_USERS_COMMENTS_NAME"), "DESCRIPTION" => GetMessage("GROUPS_AND_USERS_COMMENTS_DESCRIPTION"), "SORT" => 6, "ACTIVE" => "Y", "ALLOW_HTML" => "N", "ALLOW_ANCHOR" => "Y", "ALLOW_BIU" => "Y", "ALLOW_IMG" => "Y", "ALLOW_LIST" => "Y", "ALLOW_QUOTE" => "Y", "ALLOW_CODE" => "Y", "ALLOW_FONT" => "Y", "ALLOW_SMILES" => "Y", "ALLOW_UPLOAD" => "Y", "ALLOW_NL2BR" => "N", "MODERATION" => "N", "DEDUPLICATION" => "N", "ALLOW_MOVE_TOPIC" => "Y", "ORDER_BY" => "P", "ORDER_DIRECTION" => "DESC", "LID" => LANGUAGE_ID, "PATH2FORUM_MESSAGE" => "", "ALLOW_UPLOAD_EXT" => "", "FORUM_GROUP_ID" => $arGroupID["HIDDEN"], "ASK_GUEST_EMAIL" => "N", "USE_CAPTCHA" => "N", "SITES" => array(WIZARD_SITE_ID => WIZARD_SITE_DIR . "community/forum/messages/forum#FORUM_ID#/topic#TOPIC_ID#/message#MESSAGE_ID#/#message#MESSAGE_ID#"), "EVENT1" => "forum", "EVENT2" => "message", "EVENT3" => "", "GROUP_ID" => array("2" => "M", WIZARD_PORTAL_ADMINISTRATION_GROUP => "Y"))); foreach ($arForums as $arForum) { $dbForum = CForumNew::GetList(array(), array("SITE_ID" => WIZARD_SITE_ID, "XML_ID" => $arForum["XML_ID"])); if ($dbForum->Fetch()) { continue; } $forumID = CForumNew::Add($arForum);
} if (!in_array(WIZARD_SITE_ID, $arSites)) { $arSites[] = WIZARD_SITE_ID; $iblock = new CIBlock(); $iblock->Update($tasksIblockId, array("LID" => $arSites)); } } } if (CModule::IncludeModule("forum")) { $forumCode = "intranet_tasks"; $dbRes = CForumNew::GetListEx(array(), array("SITE_ID" => WIZARD_SITE_ID, "XML_ID" => $forumCode)); if ($arRes = $dbRes->Fetch()) { $tasksForumId = $arRes["ID"]; } else { $arGroupID = array("GENERAL" => 0, "COMMENTS" => 0, "HIDDEN" => 0); $dbExistsGroup = CForumGroup::GetListEx(array(), array("LID" => LANGUAGE_ID)); while ($arExistsGroup = $dbExistsGroup->Fetch()) { foreach ($arGroupID as $xmlID => $ID) { if ($arExistsGroup["NAME"] == GetMessage($xmlID . "_GROUP_NAME")) { $arGroupID[$xmlID] = $arExistsGroup["ID"]; } } } $arFields = array("XML_ID" => $forumCode, "NAME" => "Intranet Tasks", "DESCRIPTION" => false, "SORT" => 1, "ACTIVE" => "Y", "ALLOW_HTML" => "N", "ALLOW_ANCHOR" => "Y", "ALLOW_BIU" => "Y", "ALLOW_IMG" => "Y", "ALLOW_LIST" => "Y", "ALLOW_QUOTE" => "Y", "ALLOW_CODE" => "Y", "ALLOW_FONT" => "Y", "ALLOW_SMILES" => "Y", "ALLOW_UPLOAD" => "A", "ALLOW_NL2BR" => "N", "MODERATION" => "N", "ALLOW_MOVE_TOPIC" => "Y", "ORDER_BY" => "P", "DEDUPLICATION" => "N", "ORDER_DIRECTION" => "DESC", "LID" => LANGUAGE_ID, "PATH2FORUM_MESSAGE" => "", "ALLOW_UPLOAD_EXT" => "", "ASK_GUEST_EMAIL" => "N", "USE_CAPTCHA" => "N", "SITES" => array(WIZARD_SITE_ID => WIZARD_SITE_DIR . "community/forum/messages/forum#FORUM_ID#/topic#TOPIC_ID#/message#MESSAGE_ID#/#message#MESSAGE_ID#"), "EVENT1" => "forum", "EVENT2" => "message", "EVENT3" => "", "GROUP_ID" => array("2" => "E", WIZARD_PORTAL_ADMINISTRATION_GROUP => "Y", WIZARD_EMPLOYEES_GROUP => "M", WIZARD_PERSONNEL_DEPARTMENT_GROUP => "M"), "FORUM_GROUP_ID" => $arGroupID["HIDDEN"]); $tasksForumId = CForumNew::Add($arFields); } } CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/_index.php", array("TASKS_IBLOCK_ID" => $tasksIblockId)); CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/desktop.php", array("TASKS_IBLOCK_ID" => $tasksIblockId)); $arReplace = array("BLOG_GROUP_ID" => $blogGroupID, "FORUM_ID" => $forumID, "FILES_USER_IBLOCK_ID" => $filesUserIBlockID, "CALENDAR_USER_IBLOCK_ID" => $calendarUserIBlockID, "PHOTO_USER_IBLOCK_ID" => $photoUserIBlockID, "PHOTO_FORUM_ID" => $photoForumID, "TASKS_IBLOCK_ID" => $tasksIblockId, "TASKS_FORUM_ID" => $tasksForumId); CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/company/personal.php", $arReplace);
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; }
</option> <?php } ?> </select> </td> </tr> <?php for ($i = 0; $i < count($arSysLangs); $i++) { if ($bInitVars) { $str_NAME = $_REQUEST["FORUM_GROUP"]["LANG"][$arSysLangs[$i]]["NAME"]; $str_DESCRIPTION = $_REQUEST["FORUM_GROUP"]["LANG"][$arSysLangs[$i]]["DESCRIPTION "]; } else { $arGroupLang = CForumGroup::GetLangByID($ID, $arSysLangs[$i]); $str_NAME = $arGroupLang["NAME"]; $str_DESCRIPTION = $arGroupLang["DESCRIPTION"]; } ?> <tr class="heading"> <td colspan="2">[<?php echo $arSysLangs[$i]; ?> ] <?php echo $arSysLangNames[$i]; ?> </td> </tr> <tr class="adm-detail-required-field"> <td><?php
$forumModulePermissions = $APPLICATION->GetGroupRight("forum"); if ($forumModulePermissions == "D") { $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); } IncludeModuleLangFile(__FILE__); ClearVars(); global $by, $order; require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/forum/prolog.php"; $arSites = array(); $db_res = CSite::GetList($by1 = "sort", $order1 = "asc"); if ($db_res && ($res = $db_res->GetNext())) { do { $arSites[$res["ID"]] = $res; } while ($res = $db_res->GetNext()); } $arForumGroups = CForumGroup::GetByLang(LANGUAGE_ID); $arForumGroupsTitle = array(); array_unshift($arForumGroups, array("ID" => 0, "NAME" => "...")); foreach ($arForumGroups as $key => $res) { $arForumGroups[$res["ID"]] = $res; $arForumGroupsTitle[$res["ID"]] = str_pad("", $res["DEPTH_LEVEL"] - 1, ".") . $res["~NAME"] . " [" . $res["ID"] . "]"; } $arForumGroupsTitle[0] = "..."; $arForumSort = array(); for ($ii = 0; $ii < count($aSortTypes["reference_id"]); $ii++) { $arForumSort[$aSortTypes["reference_id"][$ii]] = $aSortTypes["reference"][$ii]; } $arForumSortDirection = array(); for ($ii = 0; $ii < count($aSortDirection["reference_id"]); $ii++) { $arForumSortDirection[$aSortDirection["reference_id"][$ii]] = $aSortDirection["reference"][$ii]; }
$rsForumGroups = CForumGroup::GetList(); while ($arForumGroup = $rsForumGroups->Fetch()) { $arForumGroup = CForumGroup::GetLangByID($arForumGroup["ID"], LANGUAGE_ID); if ($arForumGroup["NAME"] === GetMessage("DEMO_IBLOCK_ESTORE_BOOKS_FORUM_GROUP_NAME")) { break; } } if (!$arForumGroup) { $arFields = array("SORT" => 150, "LANG" => array()); $rsLanguages = CLanguage::GetList($b = "sort", $o = "asc"); while ($arLang = $rsLanguages->Fetch()) { $file = dirname(__FILE__) . "/lang/" . $arLang["LANGUAGE_ID"] . "/books-files.php"; include $file; $arFields["LANG"][] = array("LID" => $arLang["LANGUAGE_ID"], "NAME" => GetMessage("DEMO_IBLOCK_ESTORE_BOOKS_FORUM_GROUP_NAME"), "DESCRIPTION" => ""); } $arForumGroup = array("FORUM_GROUP_ID" => CForumGroup::Add($arFields)); } if ($arForumGroup["FORUM_GROUP_ID"]) { $arFields = array("NAME" => GetMessage("DEMO_IBLOCK_ESTORE_BOOKS_FORUM_NAME"), "DESCRIPTION" => "", "SORT" => 150, "ACTIVE" => "Y", "ALLOW_HTML" => "N", "ALLOW_ANCHOR" => "Y", "ALLOW_BIU" => "Y", "ALLOW_IMG" => "Y", "ALLOW_LIST" => "Y", "ALLOW_QUOTE" => "Y", "ALLOW_CODE" => "Y", "ALLOW_FONT" => "Y", "ALLOW_SMILES" => "Y", "ALLOW_UPLOAD" => "N", "ALLOW_UPLOAD_EXT" => "", "ALLOW_NL2BR" => "N", "MODERATION" => "N", "ALLOW_MOVE_TOPIC" => "N", "ORDER_BY" => "P", "ORDER_DIRECTION" => "DESC", "PATH2FORUM_MESSAGE" => "", "FORUM_GROUP_ID" => $arForumGroup["FORUM_GROUP_ID"], "ASK_GUEST_EMAIL" => "N", "USE_CAPTCHA" => "N", "SITES" => array($arParams["site_id"] => "/communication/forum/messages/forum#FORUM_ID#/topic#TOPIC_ID#/message#MESSAGE_ID#/")); $arFields["GROUP_ID"] = array("2" => "M", "19" => "Q"); if (CModule::IncludeModule("statistic")) { $arFields["EVENT1"] = "forum"; $arFields["EVENT2"] = "message"; $arFields["EVENT3"] = ""; } $arForum = array("ID" => CForumNew::Add($arFields)); } } } else { $arForum = array("ID" => ""); }
<?php echo GetMessage("FI_FORUM_LAST_MESS"); ?> </td> </tr> <?php $currentGroupID = -1; while ($ar_Forum = $db_Forum->Fetch()) { if ($USER->IsAdmin()) { $perm = "Y"; } else { $perm = ForumCurrUserPermissions($ar_Forum["ID"]); } if ($currentGroupID != IntVal($ar_Forum["FORUM_GROUP_ID"])) { if (IntVal($ar_Forum["FORUM_GROUP_ID"]) > 0) { $arCurForumGroup = CForumGroup::GetLangByID($ar_Forum["FORUM_GROUP_ID"], LANGUAGE_ID); ?> <tr class="forumbody"> <td class="forumbodytext" colspan="6"> <b><?php echo htmlspecialcharsEx($arCurForumGroup["NAME"]); ?> </b> <?php if (strlen($arCurForumGroup["DESCRIPTION"]) > 0) { ?> <br><?php echo htmlspecialcharsEx($arCurForumGroup["DESCRIPTION"]); ?> <?php }
function GetByLang($LANGUAGE_ID) { global $CACHE_MANAGER; $LANGUAGE_ID = !empty($LANGUAGE_ID) ? $LANGUAGE_ID : LANGUAGE_ID; $cache_id = "b_forum_group" . $LANGUAGE_ID; if (!is_array($GLOBALS["FORUM_CACHE"]["GROUPS"])) { $GLOBALS["FORUM_CACHE"]["GROUPS"] = array(); } if (!array_key_exists($LANGUAGE_ID, $GLOBALS["FORUM_CACHE"]["GROUPS"])) { if (CACHED_b_forum_group !== false && $CACHE_MANAGER->Read(CACHED_b_forum_group, $cache_id, "b_forum_group")) { $GLOBALS["FORUM_CACHE"]["GROUPS"][$LANGUAGE_ID] = $CACHE_MANAGER->Get($cache_id); } else { $arRes = array(); $db_res = CForumGroup::GetListEx(array("LEFT_MARGIN" => "ASC", "SORT" => "ASC"), array("LID" => $LANGUAGE_ID)); while ($res = $db_res->GetNext()) { $arRes[intVal($res["ID"])] = $res; } $GLOBALS["FORUM_CACHE"]["GROUPS"][$LANGUAGE_ID] = $arRes; if (CACHED_b_forum_group !== false) { $CACHE_MANAGER->Set($cache_id, $GLOBALS["FORUM_CACHE"]["GROUPS"][$LANGUAGE_ID]); } } } return $GLOBALS["FORUM_CACHE"]["GROUPS"][$LANGUAGE_ID]; }
continue; } $arFields = array("SORT" => 150); foreach ($arLangs as $lang) { $name = GetMessage("F_GROUP_" . $key); // $description = GetMessage("F_GROUP_".$key."_DESCRIPTION"); if ($lang != LANGUAGE_ID) { $arMess[$lang] = __GetMessageArray($lang); if (!empty($arMess[$lang]["F_GROUP_" . $key])) { $name = $arMess[$lang]["F_GROUP_" . $key]; // $description = $arMess[$lang]["F_GROUP_".$key."_DESCRIPTION"]; } } $arFields["LANG"][] = array("LID" => $lang, "NAME" => $name, "DESCRIPTION" => $description); } $arGroup[$key] = CForumGroup::Add($arFields); } } $arFieldsParams = array("SHOW_VOTE" => "N", "VOTE_CHANNEL_ID" => 0, "VOTE_GROUP_ID" => 0, "VOTE_ID" => 0, "FORUMS_ID" => ""); if (CModule::IncludeModule("vote")) { $db_res = CVoteChannel::GetList($by, $order, array('SYMBOLIC_NAME' => 'FORUM', 'SYMBOLIC_NAME_EXACT_MATCH' => 'Y'), $is_filtered); if ($db_res && ($res = $db_res->Fetch())) { $arFieldsParams = array("SHOW_VOTE" => "Y", "VOTE_CHANNEL_ID" => $res["ID"], "VOTE_GROUP_ID" => 0); //Registered users group $dbResult = CGroup::GetList($by, $order, array("STRING_ID" => "REGISTERED_USERS")); if ($dbResult && ($res = $dbResult->Fetch())) { $arFieldsParams["VOTE_GROUP_ID"] = $res["ID"]; } $db_res = CVote::GetList($by, $order, array("CHANNEL_ID" => $arFieldsParams["VOTE_CHANNEL_ID"]), $is_filtered); if ($db_res && ($res = $db_res->Fetch())) { $arFieldsParams["VOTE_ID"] = intVal($res["ID"]);
foreach ($fields["LANG"] as $lid => $name) { $fields["LANG"][$lid] = array("LID" => $lid, "NAME" => $_REQUEST["FORUM_GROUP"]["LANG"][$lid]["NAME"], "DESCRIPTION" => $_REQUEST["FORUM_GROUP"]["LANG"][$lid]["DESCRIPTION"]); } if (!CForumGroup::CheckFields($ID > 0 ? "UPDATE" : "ADD", $fields, $ID > 0 ? $ID : false)) { $arError[] = array("code" => "error_checkfields", "title" => GetMessage("ERROR_ADD_GROUP_BAD_FIELDS")); } else { if ($ID > 0 && !CForumGroup::CanUserUpdateGroup($ID, $USER->GetUserGroupArray())) { $arError[] = array("code" => "not_right_for_edit", "title" => GetMessage("ERROR_EDIT_GROUP_NOT_RIGHT")); } else { if ($ID > 0 && CForumGroup::Update($ID, $fields) != $ID) { $arError[] = array("code" => "not_edit", "title" => GetMessage("ERROR_EDIT_GROUP")); } else { if ($ID <= 0 && !CForumGroup::CanUserAddGroup($USER->GetUserGroupArray())) { $arError[] = array("code" => "not_right_for_add", "title" => GetMessage("ERROR_ADD_GROUP_NOT_RIGHT")); } else { if ($ID <= 0 && ($ID = intval(CForumGroup::Add($fields))) && $ID <= 0) { $arError[] = array("code" => "not_add", "title" => GetMessage("ERROR_ADD_GROUP")); } else { BXClearCache(true, "bitrix/forum/group/"); LocalRedirect((array_key_exists("save", $_POST) ? "forum_group.php?" : "forum_group_edit.php?ID=" . $ID . "&") . "lang=" . LANG . GetFilterParams("filter_", false)); } } } } } $message = new CAdminMessage($ID > 0 ? GetMessage("ERROR_EDIT_GROUP") : GetMessage("ERROR_ADD_GROUP"), $GLOBALS["APPLICATION"]->GetException()); } $APPLICATION->SetTitle($ID > 0 ? str_replace("#ID#", $ID, GetMessage("FORUM_EDIT_RECORD")) : GetMessage("FORUM_NEW_RECORD")); require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php"; /*********************************************************************/ /******************** BODY *****************************************/
if ($iGroupId <= 0) { // Set Group $arFields = array("SORT" => 150); foreach ($arLangs as $lang) { $name = GetMessage("P_FORUM_GROUP_COMMENTS"); $description = GetMessage("P_FORUM_GROUP_COMMENTS_DESCRIPTION"); if ($lang != LANGUAGE_ID) { $arMess[$lang] = __GetMessageArray($lang); if (!empty($arMess[$lang]["P_FORUM_GROUP_COMMENTS"])) { $name = $arMess[$lang]["P_FORUM_GROUP_COMMENTS"]; $description = $arMess[$lang]["P_FORUM_GROUP_COMMENTS_DESCRIPTION"]; } } $arFields["LANG"][] = array("LID" => $lang, "NAME" => $name, "DESCRIPTION" => $description); } $iGroupId = CForumGroup::Add($arFields); } // 3.2 Add Forum $FID = 0; $db_res = CForumNew::GetList(); if ($db_res && ($res = $db_res->Fetch())) { do { if ($res["NAME"] == GetMessage("P_FORUM_NAME")) { $FID = intVal($res["ID"]); break; } } while ($res = $db_res->Fetch()); } if ($FID <= 0) { $arFields = array("NAME" => GetMessage("P_FORUM_NAME"), "DESCRIPTION" => GetMessage("P_FORUM_DECRIPTION"), "SORT" => 100, "ACTIVE" => "Y", "ALLOW_HTML" => "N", "ALLOW_ANCHOR" => "N", "ALLOW_BIU" => "Y", "ALLOW_IMG" => "Y", "ALLOW_LIST" => "Y", "ALLOW_QUOTE" => "Y", "ALLOW_CODE" => "Y", "ALLOW_FONT" => "Y", "ALLOW_SMILES" => "Y", "ALLOW_UPLOAD" => "N", "ALLOW_NL2BR" => "N", "MODERATION" => "N", "ALLOW_MOVE_TOPIC" => "Y", "ORDER_BY" => "P", "ORDER_DIRECTION" => "DESC", "LID" => LANGUAGE_ID, "PATH2FORUM_MESSAGE" => "", "ALLOW_UPLOAD_EXT" => "", "FORUM_GROUP_ID" => $iGroupId, "ASK_GUEST_EMAIL" => "N", "USE_CAPTCHA" => "Y", "SITES" => array($SITE_ID => "/communication/forum/messages/forum#FORUM_ID#/topic#TOPIC_ID#/message#MESSAGE_ID#/"), "EVENT1" => "forum", "EVENT2" => "message", "EVENT3" => "", "GROUP_ID" => array("2" => "M", "4" => "A", "5" => "A", "11" => "A", "15" => "A", "16" => "A", "17" => "A", "18" => "A", "19" => "Q", "20" => "A")); $FID = CForumNew::Add($arFields);
$arGroupLang = CForumGroup::GetLangByID($f_ID, LANG); $fieldShow = htmlspecialcharsbx($arGroupLang["NAME"]); $row->AddViewField("NAME", '<a title="' . GetMessage("FORUM_EDIT_DESCR") . '" href="' . "forum_group_edit.php?ID=" . $f_ID . "&lang=" . LANG . "&" . GetFilterParams("filter_") . '">' . $fieldShow . '</a>'); } $arActions = array(); if ($forumModulePermissions >= "R" && CForumGroup::CanUserUpdateGroup(0, $USER->GetUserGroupArray())) { $arActions[] = array("ICON" => "edit", "TEXT" => GetMessage("FORUM_EDIT_DESCR"), "ACTION" => $lAdmin->ActionRedirect("forum_group_edit.php?ID=" . $f_ID . "&lang=" . LANG . "&" . GetFilterParams("filter_", false)), "DEFAULT" => true); } if ($forumModulePermissions >= "W" && CForumGroup::CanUserDeleteGroup(0, $USER->GetUserGroupArray())) { $arActions[] = array("SEPARATOR" => true); $arActions[] = array("ICON" => "delete", "TEXT" => GetMessage("FORUM_DELETE_DESCR"), "ACTION" => "if(confirm('" . GetMessage('GROUP_DEL_CONF') . "')) " . $lAdmin->ActionDoGroup($f_ID, "delete")); } $row->AddActions($arActions); } /*******************************************************************/ $lAdmin->AddFooter(array(array("title" => GetMessage("MAIN_ADMIN_LIST_SELECTED"), "value" => $dbResultList->SelectedRowsCount()), array("counter" => true, "title" => GetMessage("MAIN_ADMIN_LIST_CHECKED"), "value" => "0"))); /*******************************************************************/ $lAdmin->AddGroupActionTable(array("delete" => GetMessage("MAIN_ADMIN_LIST_DELETE"))); if ($forumModulePermissions >= "W" && CForumGroup::CanUserAddGroup($USER->GetUserGroupArray())) { $aContext = array(array("TEXT" => GetMessage("FGAN_ADD_NEW"), "LINK" => "forum_group_edit.php?lang=" . LANG, "TITLE" => GetMessage("FGAN_ADD_NEW_ALT"), "ICON" => "btn_new")); $lAdmin->AddAdminContextMenu($aContext); } /*******************************************************************/ $lAdmin->CheckListMode(); /****************************************************************************/ /*********** MAIN PAGE ****************************************************/ /****************************************************************************/ $APPLICATION->SetTitle(GetMessage("GROUP_TITLE")); require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php"; $lAdmin->DisplayList(); require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";