2##############################################
3# Bitrix Site Manager Forum #
4# Copyright (c) 2002-2009 Bitrix #
6# mailto:admin@bitrixsoft.com #
7##############################################
8require_once(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/forum/classes/general/forum_new.php");
22 foreach (
GetModuleEvents(
"forum",
"onBeforeForumAdd",
true) as $arEvent)
31 $strSql =
"INSERT INTO b_forum(".$arInsert[0].
") VALUES(".$arInsert[1].
")";
33 $ID = intval(
$DB->LastID());
39 $DB->Query(
"INSERT INTO b_forum2site (FORUM_ID, SITE_ID, PATH2FORUM_MESSAGE) VALUES(".
$ID.
", '".
$DB->ForSql(
$key, 2).
"', '".
$DB->ForSql($value, 250).
"')");
53 public static function reindex(&
$NS, $oCallback = NULL, $callback_method =
"")
60 $lastMessageId = intval(
$NS[
"ID"]);
61 if (
$NS[
"MODULE"] ==
"forum" && $lastMessageId > 0)
64 "FM.ID>".$lastMessageId :
65 "FM.ID>=".$lastMessageId
69 if (
$NS[
"SITE_ID"] !=
"")
71 $join[] =
" INNER JOIN b_forum2site FS ON (FS.FORUM_ID=F.ID) ";
72 $filter[] =
"FS.SITE_ID='".$DB->ForSQL(
$NS[
"SITE_ID"]).
"' ";
74 if (array_key_exists(
"FILTER",
$NS))
75 foreach (
$NS[
"FILTER"] as
$f)
77 if (array_key_exists(
"JOIN",
$NS))
78 foreach (
$NS[
"JOIN"] as $j)
83 "SELECT STRAIGHT_JOIN FT.ID as TID, FM.ID as MID,
84 ".CForumTopic::GetSelectFields(
array(
"sPrefix" =>
"FT_",
"sReturnResult" =>
"string")).
",
85 FM.*, ".
$DB->DateToCharFunction(
"FM.POST_DATE",
"FULL").
" as POST_DATE,
86 ".
$DB->DateToCharFunction(
"FM.EDIT_DATE",
"FULL").
" as EDIT_DATE,
87 FU.SHOW_NAME, FU.DESCRIPTION, FU.NUM_POSTS, FU.POINTS as NUM_POINTS, FU.SIGNATURE, FU.AVATAR, FU.RANK_ID,
88 ".
$DB->DateToCharFunction(
"FU.DATE_REG",
"SHORT").
" as DATE_REG,
89 U.EMAIL, U.PERSONAL_ICQ, U.LOGIN, U.NAME, U.SECOND_NAME, U.LAST_NAME, U.PERSONAL_PHOTO
90 FROM b_forum_message FM use index (PRIMARY)
91 LEFT JOIN b_forum_topic FT ON (FM.TOPIC_ID = FT.ID)
92 LEFT JOIN b_forum F ON (F.ID = FT.FORUM_ID)
93 LEFT JOIN b_forum_user FU ON (FM.AUTHOR_ID = FU.USER_ID)
94 LEFT JOIN b_user U ON (FM.AUTHOR_ID = U.ID)
95 ".implode(
" ", $join).
"
96 WHERE (F.INDEXATION = 'Y' AND FM.APPROVED = 'Y') ".(empty(
$filter) ?
"" :
" AND ".implode(
" AND ",
$filter)).
"
98 $cnt = intval(COption::GetOptionInt(
"forum",
"search_message_count", 50));
100 $strSql .=
" LIMIT 0, ".$cnt;
103 if (COption::GetOptionString(
"forum",
"FILTER",
"Y") ==
"Y")
112 static $permissions =
array();
116 $lastMessageId =
$res[
"ID"];
118 if (!array_key_exists(
$res[
"FORUM_ID"], $permissions))
120 $permissions[
$res[
"FORUM_ID"]] =
array();
124 if ($group[1] >=
"E")
126 $permissions[
$res[
"FORUM_ID"]][] = $group[0];
136 "LAST_MODIFIED" => ((!empty(
$res[
"EDIT_DATE"])) ?
$res[
"EDIT_DATE"] :
$res[
"POST_DATE"]),
137 "PARAM1" =>
$res[
"FORUM_ID"],
138 "PARAM2" =>
$res[
"TOPIC_ID"],
139 "USER_ID" =>
$res[
"AUTHOR_ID"],
140 "ENTITY_TYPE_ID" => (
$res[
"NEW_TOPIC"] ==
"Y" ?
"FORUM_TOPIC" :
"FORUM_POST"),
141 "ENTITY_ID" => (
$res[
"NEW_TOPIC"] ==
"Y" ?
$res[
"TOPIC_ID"] :
$res[
"ID"]),
142 "PERMISSIONS" => $permissions[
$res[
"FORUM_ID"]],
143 "TITLE" =>
$res[
"FT_TITLE"].(
$res[
"NEW_TOPIC"] ==
"Y" && !empty(
$res[
"FT_DESCRIPTION"]) ?
144 ", ".
$res[
"FT_DESCRIPTION"] :
""),
145 "TAGS" => (
$res[
"NEW_TOPIC"] ==
"Y" ?
$res[
"FT_TAGS"] :
""),
148 COption::GetOptionString(
"forum",
"FILTER",
"Y") !=
"Y" ?
$res[
"POST_MESSAGE"] :
$res[
"POST_MESSAGE_FILTER"]),
150 "INDEX_TITLE" =>
$res[
"NEW_TOPIC"] ==
"Y",
152 if (!array_key_exists(
$res[
"FORUM_ID"],
$sites))
158 "FORUM_ID"=>
$res[
"FORUM_ID"],
159 "TOPIC_ID"=>
$res[
"TOPIC_ID"],
160 "TITLE_SEO"=>
$res[
"FT_TITLE_SEO"],
161 "MESSAGE_ID"=>
$res[
"ID"],
162 "SOCNET_GROUP_ID" =>
$res[
"FT_SOCNET_GROUP_ID"],
163 "OWNER_ID" =>
$res[
"FT_OWNER_ID"],
164 "PARAM1" =>
$res[
"PARAM1"],
165 "PARAM2" =>
$res[
"PARAM2"]));
172 static $defaultUrl =
array();
173 if (array_key_exists(
$res[
"FORUM_ID"], $defaultUrl))
175 $defaultUrl[
$res[
"FORUM_ID"]] =
"/";
180 $defaultUrl[
$res[
"FORUM_ID"]] =
$lang[
"DIR"];
184 $defaultUrl[
$res[
"FORUM_ID"]] .= COption::GetOptionString(
"forum",
"REL_FPATH",
"").
"forum/read.php?FID=#FID#&TID=#TID#&MID=#MID##message#MID#";
187 $defaultUrl[
$res[
"FORUM_ID"]],
189 "FORUM_ID"=>
$res[
"FORUM_ID"],
190 "TOPIC_ID"=>
$res[
"TOPIC_ID"],
191 "TITLE_SEO"=>
$res[
"FT_TITLE_SEO"],
192 "MESSAGE_ID"=>
$res[
"ID"],
193 "SOCNET_GROUP_ID" =>
$res[
"FT_SOCNET_GROUP_ID"],
194 "OWNER_ID" =>
$res[
"FT_OWNER_ID"],
195 "PARAM1" =>
$res[
"PARAM1"],
196 "PARAM2" =>
$res[
"PARAM2"]
202 foreach(
GetModuleEvents(
"forum",
"onMessageIsIndexed",
true) as $arEvent)
213 if ($oCallback && !call_user_func(
array($oCallback, $callback_method),
$result))
226 if ($oCallback && ($cnt > 0) && ($rownum >= ($cnt - 1)))
227 return $lastMessageId;
237 $ResultType = (in_array($ResultType,
array(
"timestamp",
"time")) ? $ResultType :
"timestamp");
239 $db_res =
$DB->Query(
"SELECT ".
$DB->DateToCharFunction(
$DB->GetNowFunction(),
"FULL").
" FORUM_DATE");
249 return "TRIM(BOTH '".$glue.
"' FROM REPLACE(CONCAT_WS('".$glue.
"',".implode(
",", $pieces).
"), '".$glue.$glue.
"', '".$glue.
"'))";
264 if(CACHED_b_forum_group !==
false)
265 $GLOBALS[
"CACHE_MANAGER"]->CleanDir(
"b_forum_group");
268 while ($arEvent = $events->Fetch())
276 $arInsert =
$DB->PrepareInsert(
"b_forum_group",
$arFields);
277 $strSql =
"INSERT INTO b_forum_group(".$arInsert[0].
") VALUES(".$arInsert[1].
")";
279 $ID = intval(
$DB->LastID());
285 $arInsert =
$DB->PrepareInsert(
"b_forum_group_lang",
$l);
286 $strSql =
"INSERT INTO b_forum_group_lang(FORUM_GROUP_ID, ".$arInsert[0].
") VALUES(".
$ID.
", ".$arInsert[1].
")";
292 foreach (
GetModuleEvents(
"forum",
"onAfterGroupForumsAdd",
true) as $arEvent)
308 if(CACHED_b_forum_group !==
false)
309 $GLOBALS[
"CACHE_MANAGER"]->CleanDir(
"b_forum_group");
311 foreach (
GetModuleEvents(
"forum",
"onBeforeGroupForumsUpdate",
true) as $arEvent)
319 $strUpdate =
$DB->PrepareUpdate(
"b_forum_group",
$arFields);
320 if (!empty($strUpdate))
322 $strSql =
"UPDATE b_forum_group SET ".$strUpdate.
" WHERE ID = ".
$ID;
327 $DB->Query(
"DELETE FROM b_forum_group_lang WHERE FORUM_GROUP_ID = ".
$ID);
331 $arInsert =
$DB->PrepareInsert(
"b_forum_group_lang",
$l);
332 $strSql =
"INSERT INTO b_forum_group_lang(FORUM_GROUP_ID, ".$arInsert[0].
") VALUES(".
$ID.
", ".$arInsert[1].
")";
338 foreach (
GetModuleEvents(
"forum",
"onAfterGroupForumsUpdate",
true) as $arEvent)
static Resort($ID=0, $cnt=0, $depth=0)
static CheckFields($ACTION, &$arFields, $ID=false)
static GetAccessPermissions($ID, $TYPE="ONE")
static PreparePath2Message($strPath, $arVals=array())
static CheckFields($ACTION, &$arFields)
static SetAccessPermissions($ID, $arGROUP_ID)
static Update($ID, $arFields)
static reindex(&$NS, $oCallback=NULL, $callback_method="")
static GetNowTime($ResultType="timestamp")
static Concat($glue="", $pieces=array())
static clearAllTags($text)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
$_SERVER["DOCUMENT_ROOT"]
if(!defined('SITE_ID')) $lang
if(!defined('NOT_CHECK_PERMISSIONS')) $NS
ExecuteModuleEventEx($arEvent, $arParams=[])
GetModuleEvents($MODULE_ID, $MESSAGE_ID, $bReturnArray=false)
GetMessage($name, $aReplace=null)
MakeTimeStamp($datetime, $format=false)
if(empty($signedUserToken)) $key
$GLOBALS['_____370096793']