1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
blog_comment.php
См. документацию.
1<?php
2
4
5$GLOBALS["BLOG_COMMENT"] = Array();
6
8{
9 const UF_NAME = 'UF_BLOG_COMMENT_DOC';
10 /*************** ADD, UPDATE, DELETE *****************/
11 public static function CheckFields($ACTION, &$arFields, $ID = 0)
12 {
13 global $DB, $APPLICATION;
14
15 if ((is_set($arFields, "BLOG_ID") || $ACTION=="ADD") && intval($arFields["BLOG_ID"]) <= 0)
16 {
17 $APPLICATION->ThrowException(GetMessage("BLG_GCM_EMPTY_BLOG_ID"), "EMPTY_BLOG_ID");
18 return false;
19 }
20 elseif (is_set($arFields, "BLOG_ID"))
21 {
23 if (!$arResult)
24 {
25 $APPLICATION->ThrowException(str_replace("#ID#", $arFields["BLOG_ID"], GetMessage("BLG_GCM_ERROR_NO_BLOG")), "ERROR_NO_BLOG");
26 return false;
27 }
28 }
29
30 if ((is_set($arFields, "POST_ID") || $ACTION=="ADD") && intval($arFields["POST_ID"]) <= 0)
31 {
32 $APPLICATION->ThrowException(GetMessage("BLG_GCM_EMPTY_POST_ID"), "EMPTY_POST_ID");
33 return false;
34 }
35 elseif (is_set($arFields, "POST_ID"))
36 {
38 if (!$arResult)
39 {
40 $APPLICATION->ThrowException(str_replace("#ID#", $arFields["POST_ID"], GetMessage("BLG_GCM_ERROR_NO_POST")), "ERROR_NO_POST");
41 return false;
42 }
43 }
44
45 if (is_set($arFields, "PARENT_ID") && $arFields["PARENT_ID"])
46 {
48 if (!$arResult)
49 {
50 $APPLICATION->ThrowException(str_replace("#ID#", $arFields["PARENT_ID"], GetMessage("BLG_GCM_ERROR_NO_COMMENT")), "ERROR_NO_COMMENT");
51 return false;
52 }
53 }
54
55 if (is_set($arFields, "AUTHOR_ID"))
56 {
57 if (intval($arFields["AUTHOR_ID"]) <= 0)
58 {
59 $APPLICATION->ThrowException(GetMessage("BLG_GCM_EMPTY_AUTHOR_ID"), "EMPTY_AUTHOR_ID");
60 return false;
61 }
62 else
63 {
64 $dbResult = CUser::GetByID($arFields["AUTHOR_ID"]);
65 if (!$dbResult->Fetch())
66 {
67 $APPLICATION->ThrowException(GetMessage("BLG_GCM_ERROR_NO_AUTHOR_ID"), "ERROR_NO_AUTHOR_ID");
68 return false;
69 }
70 }
71 }
72 else
73 {
74 if ((is_set($arFields, "AUTHOR_NAME") || $ACTION=="ADD") && $arFields["AUTHOR_NAME"] == '')
75 {
76 $APPLICATION->ThrowException(GetMessage("BLG_GCM_EMPTY_AUTHOR_NAME"), "EMPTY_AUTHOR_NAME");
77 return false;
78 }
79 }
80
81 if (is_set($arFields, "AUTHOR_EMAIL") && $arFields["AUTHOR_EMAIL"] <> '')
82 {
83 if (!check_email($arFields["AUTHOR_EMAIL"]))
84 {
85 $APPLICATION->ThrowException(GetMessage("BLG_GCM_ERROR_AUTHOR_EMAIL"), "ERROR_AUTHOR_EMAIL");
86 return false;
87 }
88 }
89
90 if ((is_set($arFields, "DATE_CREATE") || $ACTION=="ADD") && (!$DB->IsDate($arFields["DATE_CREATE"], false, LANG, "FULL")))
91 {
92 $APPLICATION->ThrowException(GetMessage("BLG_GCM_ERROR_DATE_CREATE"), "ERROR_DATE_CREATE");
93 return false;
94 }
95
96 if ((is_set($arFields, "POST_TEXT") || $ACTION=="ADD") && $arFields["POST_TEXT"] == '')
97 {
98 $APPLICATION->ThrowException(GetMessage("BLG_GCM_EMPTY_POST_TEXT"), "EMPTY_POST_TEXT");
99 return false;
100 }
101
102 if (!empty($arFields["POST_TEXT"]))
103 {
104 $arFields["POST_TEXT"] = \Bitrix\Main\Text\Emoji::encode($arFields["POST_TEXT"]);
105 }
106
107 return True;
108 }
109
110 public static function Delete($ID)
111 {
112 global $DB, $USER_FIELD_MANAGER;
113
114 $ID = intval($ID);
115
117
118 foreach(GetModuleEvents("blog", "OnBeforeCommentDelete", true) as $arEvent)
119 {
120 if (ExecuteModuleEventEx($arEvent, Array($ID))===false)
121 return false;
122 }
123
124 if ($arResult)
125 {
126 $DB->Query(
127 "UPDATE b_blog_comment SET ".
128 " PARENT_ID = ".((intval($arResult["PARENT_ID"]) > 0) ? intval($arResult["PARENT_ID"]) : "null")." ".
129 "WHERE PARENT_ID = ".$ID." ".
130 " AND BLOG_ID = ".intval($arResult["BLOG_ID"])." ".
131 " AND POST_ID = ".intval($arResult["POST_ID"])." ",
132 true
133 );
134
135 $updateFields = [
136 "=NUM_COMMENTS_ALL" => "NUM_COMMENTS_ALL - 1"
137 ];
138 if($arResult["PUBLISH_STATUS"] === BLOG_PUBLISH_STATUS_PUBLISH)
139 {
140 $updateFields["=NUM_COMMENTS"] = "NUM_COMMENTS - 1";
141 }
142 CBlogPost::Update($arResult["POST_ID"], $updateFields);
143
144 $res = CBlogImage::GetList(array(), array("BLOG_ID" => $arResult["BLOG_ID"], "POST_ID"=>$arResult["POST_ID"], "IS_COMMENT" => "Y", "COMMENT_ID" => $ID));
145 while($aImg = $res->Fetch())
146 CBlogImage::Delete($aImg['ID']);
147
148 $USER_FIELD_MANAGER->Delete("BLOG_COMMENT", $ID);
149 }
150
151 unset($GLOBALS["BLOG_COMMENT"]["BLOG_COMMENT_CACHE_".$ID]);
152
153 foreach(GetModuleEvents("blog", "OnCommentDelete", true) as $arEvent)
154 ExecuteModuleEventEx($arEvent, Array($ID));
155
156 if (CModule::IncludeModule("search"))
157 {
158 CSearch::Index("blog", "C".$ID,
159 array(
160 "TITLE" => "",
161 "BODY" => ""
162 )
163 );
164 }
165
166 return $DB->Query("DELETE FROM b_blog_comment WHERE ID = ".$ID."", true);
167 }
168
169 //*************** SELECT *********************/
170 public static function GetByID($ID)
171 {
172 global $DB;
173
174 $ID = intval($ID);
175
176 if (isset($GLOBALS["BLOG_COMMENT"]["BLOG_COMMENT_CACHE_".$ID]) && is_array($GLOBALS["BLOG_COMMENT"]["BLOG_COMMENT_CACHE_".$ID]) && is_set($GLOBALS["BLOG_COMMENT"]["BLOG_COMMENT_CACHE_".$ID], "ID"))
177 {
178 return $GLOBALS["BLOG_COMMENT"]["BLOG_COMMENT_CACHE_".$ID];
179 }
180 else
181 {
182 $strSql =
183 "SELECT C.ID, C.BLOG_ID, C.POST_ID, C.PARENT_ID, C.AUTHOR_ID, C.AUTHOR_NAME, ".
184 " C.AUTHOR_EMAIL, C.AUTHOR_IP, C.AUTHOR_IP1, C.TITLE, C.POST_TEXT, ".
185 " ".$DB->DateToCharFunction("C.DATE_CREATE", "FULL")." as DATE_CREATE, ".
186 " C.PUBLISH_STATUS, C.PATH, C.SHARE_DEST ".
187 "FROM b_blog_comment C ".
188 "WHERE C.ID = ".$ID."";
189 $dbResult = $DB->Query($strSql);
190 if ($arResult = $dbResult->Fetch())
191 {
192 $GLOBALS["BLOG_COMMENT"]["BLOG_COMMENT_CACHE_".$ID] = $arResult;
193 return $arResult;
194 }
195 }
196
197 return False;
198 }
199
200 public static function BuildRSS($postID, $blogID, $type = "RSS2.0", $numPosts = 10, $arPathTemplate = Array())
201 {
202 global $USER;
203
204 $blogID = intval($blogID);
205 $postID = intval($postID);
206 if($blogID <= 0)
207 return false;
208 if($postID <= 0)
209 return false;
210 $numPosts = intval($numPosts);
211 $type = mb_strtolower(preg_replace("/[^a-zA-Z0-9.]/is", "", $type));
212 if ($type != "rss.92" && $type != "atom.03")
213 $type = "rss2.0";
214
215 $rssText = False;
216
217 $arBlog = CBlog::GetByID($blogID);
218 if ($arBlog && $arBlog["ACTIVE"] == "Y" && $arBlog["ENABLE_RSS"] == "Y")
219 {
220 $arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
221 if($arGroup["SITE_ID"] == SITE_ID)
222 {
223 $arPost = CBlogPost::GetByID($postID);
224 if(!empty($arPost) && $arPost["BLOG_ID"] == $arBlog["ID"] && $arPost["ENABLE_COMMENTS"] == "Y")
225 {
226 $now = date("r");
227 $nowISO = date("Y-m-d\TH:i:s").mb_substr(date("O"), 0, 3).":".mb_substr(date("O"), -2, 2);
228
229 $serverName = "";
230 $charset = "";
231 $language = "";
232 $dbSite = CSite::GetList("sort", "asc", array("LID" => SITE_ID));
233 if ($arSite = $dbSite->Fetch())
234 {
235 $serverName = $arSite["SERVER_NAME"];
236 $charset = $arSite["CHARSET"];
237 $language = $arSite["LANGUAGE_ID"];
238 }
239
240 if ($serverName == '')
241 {
242 if (defined("SITE_SERVER_NAME") && SITE_SERVER_NAME <> '')
243 $serverName = SITE_SERVER_NAME;
244 else
245 $serverName = COption::GetOptionString("main", "server_name", "");
246 }
247 $serverName = \Bitrix\Main\Text\HtmlFilter::encode($serverName);
248
249 if ($charset == '')
250 {
251 if (defined("SITE_CHARSET") && SITE_CHARSET <> '')
252 $charset = SITE_CHARSET;
253 else
254 $charset = "windows-1251";
255 }
256
257 if($arPathTemplate["PATH_TO_BLOG"] <> '')
258 $blogURL = "http://".$serverName.htmlspecialcharsbx(CComponentEngine::MakePathFromTemplate($arPathTemplate["PATH_TO_BLOG"], array("blog" => $arBlog["URL"], "user_id" => $arBlog["OWNER_ID"], "group_id" => $arBlog["SOCNET_GROUP_ID"])));
259 else
260 $blogURL = "http://".$serverName.htmlspecialcharsbx(CBlog::PreparePath($arBlog["URL"], $arGroup["SITE_ID"]));
261
262 if($arPathTemplate["PATH_TO_POST"] <> '')
263 $url = "http://".$serverName.htmlspecialcharsbx(CComponentEngine::MakePathFromTemplate($arPathTemplate["PATH_TO_POST"], array("blog" => $arBlog["URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arPathTemplate["ALLOW_POST_CODE"]), "user_id" => $arBlog["OWNER_ID"], "group_id" => $arBlog["SOCNET_GROUP_ID"])));
264 else
265 $url = "http://".$serverName.htmlspecialcharsbx(CBlogPost::PreparePath($arBlog["URL"], $arPost["ID"], $arGroup["SITE_ID"]));
266
267 $dbUser = CUser::GetByID($arPost["AUTHOR_ID"]);
268 $arUser = $dbUser->Fetch();
269
270 if($arPathTemplate["USE_SOCNET"] == "Y")
271 {
272 $blogName = GetMessage("BLG_GCM_RSS_TITLE_SOCNET", Array("#AUTHOR_NAME#" => htmlspecialcharsEx($arUser["NAME"]." ".$arUser["LAST_NAME"]), "#POST_TITLE#" => htmlspecialcharsEx($arPost["TITLE"])));
273 }
274 else
275 {
276 $blogName = GetMessage("BLG_GCM_RSS_TITLE", Array("#BLOG_NAME#" => htmlspecialcharsEx($arBlog["NAME"]), "#POST_TITLE#" => htmlspecialcharsEx($arPost["TITLE"])));
277 }
278
279 $rssText = "";
280 if ($type == "rss.92")
281 {
282 $rssText .= "<"."?xml version=\"1.0\" encoding=\"".$charset."\"?".">\n\n";
283 $rssText .= "<rss version=\".92\">\n";
284 $rssText .= " <channel>\n";
285 $rssText .= " <title>".$blogName."</title>\n";
286 $rssText .= " <description>".$blogName."</description>\n";
287 $rssText .= " <link>".$url."</link>\n";
288 $rssText .= " <language>".$language."</language>\n";
289 $rssText .= " <docs>http://backend.userland.com/rss092</docs>\n";
290 $rssText .= "\n";
291 }
292 elseif ($type == "rss2.0")
293 {
294 $rssText .= "<"."?xml version=\"1.0\" encoding=\"".$charset."\"?".">\n\n";
295 $rssText .= "<rss version=\"2.0\">\n";
296 $rssText .= " <channel>\n";
297 $rssText .= " <title>".$blogName."</title>\n";
298 $rssText .= " <description>".$blogName."</description>\n";
299 //$rssText .= " <guid>".$url."</guid>\n";
300 $rssText .= " <link>".$url."</link>\n";
301 $rssText .= " <language>".$language."</language>\n";
302 $rssText .= " <docs>http://backend.userland.com/rss2</docs>\n";
303 $rssText .= " <pubDate>".$now."</pubDate>\n";
304 $rssText .= "\n";
305 }
306 elseif ($type == "atom.03")
307 {
308 $atomID = "tag:".$serverName.",".date("Y-m-d").":".$postID;
309
310 $rssText .= "<"."?xml version=\"1.0\" encoding=\"".$charset."\"?".">\n\n";
311 $rssText .= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\" xml:lang=\"".$language."\">\n";
312 $rssText .= " <title>".$blogName."</title>\n";
313 $rssText .= " <tagline>".$url."</tagline>\n";
314 $rssText .= " <id>".$atomID."</id>\n";
315 $rssText .= " <link rel=\"alternate\" type=\"text/html\" href=\"".$url."\" />\n";
316 $rssText .= " <modified>".$nowISO."</modified>\n";
317
318 $BlogUser = CBlogUser::GetByID($arPost["AUTHOR_ID"], BLOG_BY_USER_ID);
319 $authorP = htmlspecialcharsex(CBlogUser::GetUserName($BlogUser["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"], $arUser["SECOND_NAME"]));
320 if($arPathTemplate["PATH_TO_USER"] <> '')
321 $authorURLP = "http://".$serverName.htmlspecialcharsbx(CComponentEngine::MakePathFromTemplate($arPathTemplate["PATH_TO_USER"], array("user_id"=>$arPost["AUTHOR_ID"])));
322 else
323 $authorURLP = "http://".$serverName.htmlspecialcharsbx(CBlogUser::PreparePath($arPost["AUTHOR_ID"], $arGroup["SITE_ID"]));
324
325 $rssText .= " <author>\n";
326 $rssText .= " <name>".$authorP."</name>\n";
327 $rssText .= " <uri>".$authorURLP."</uri>\n";
328 $rssText .= " </author>\n";
329
330 $rssText .= "\n";
331 }
332
333 $user_id = $USER->GetID();
334 if($arPathTemplate["USE_SOCNET"] == "Y")
335 {
336 $postPerm = CBlogPost::GetSocNetPostPerms($postID);
337 if($postPerm > BLOG_PERMS_DENY)
338 $postPerm = CBlogComment::GetSocNetUserPerms($postID, $arPost["AUTHOR_ID"]);
339 }
340 else
341 $postPerm = CBlogPost::GetBlogUserCommentPerms($postID, intval($user_id));
342
343 if($postPerm >= BLOG_PERMS_READ)
344 {
345 $parser = new blogTextParser();
346 $arParserParams = Array(
347 "imageWidth" => $arPathTemplate["IMAGE_MAX_WIDTH"],
348 "imageHeight" => $arPathTemplate["IMAGE_MAX_HEIGHT"],
349 );
350
351 CTimeZone::Disable();
352 $dbComments = CBlogComment::GetList(
353 array("DATE_CREATE" => "DESC"),
354 array(
355 //"BLOG_ID" => $blogID,
356 "POST_ID" => $postID,
357 "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH,
358 ),
359 false,
360 array("nTopCount" => $numPosts),
361 array("ID", "TITLE", "DATE_CREATE", "POST_TEXT", "AUTHOR_EMAIL", "AUTHOR_ID", "AUTHOR_NAME", "USER_LOGIN", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_NAME", "BLOG_USER_ALIAS")
362 );
363 CTimeZone::Enable();
364 $arImages = Array();
365 $dbImages = CBlogImage::GetList(Array(), Array("BLOG_ID" => $blogID, "POST_ID" => $postID, "IS_COMMENT" => "Y", "!COMMENT_ID" => false));
366 while($arI = $dbImages->Fetch())
367 $arImages[$arI["ID"]] = $arI["FILE_ID"];
368
369 while ($arComments = $dbComments->Fetch())
370 {
371 $arDate = ParseDateTime($arComments["DATE_CREATE"], CSite::GetDateFormat("FULL", $arGroup["SITE_ID"]));
372 $date = date("r", mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));
373
374 if(mb_strpos($url, "?") !== false)
375 $url1 = $url."&amp;";
376 else
377 $url1 = $url."?";
378 $url1 .= "commentId=".$arComments["ID"]."#com".$arComments["ID"];
379
380 $authorURL = "";
381 if(intval($arComments["AUTHOR_ID"]) > 0)
382 {
383 $author = CBlogUser::GetUserName($arComments["BLOG_USER_ALIAS"], $arComments["USER_NAME"], $arComments["USER_LAST_NAME"], $arComments["USER_LOGIN"], $arComments["USER_SECOND_NAME"]);
384 if($arPathTemplate["PATH_TO_USER"] <> '')
385 $authorURL = "http://".$serverName.htmlspecialcharsbx(CComponentEngine::MakePathFromTemplate($arPathTemplate["PATH_TO_USER"], array("user_id"=>$arComments["AUTHOR_ID"])));
386 else
387 $authorURL = "http://".$serverName.htmlspecialcharsbx(CBlogUser::PreparePath($arComments["AUTHOR_ID"], $arGroup["SITE_ID"]));
388 }
389 else
390 $author = $arComments["AUTHOR_NAME"];
391 $arAllow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "Y", "TABLE" => "Y", "CUT_ANCHOR" => "N");
392 if($arPathTemplate["NO_URL_IN_COMMENTS"] == "L" || (intval($arComments["AUTHOR_ID"]) <= 0 && $arPathTemplate["NO_URL_IN_COMMENTS"] == "A"))
393 $arAllow["CUT_ANCHOR"] = "Y";
394
395 if($arPathTemplate["NO_URL_IN_COMMENTS_AUTHORITY_CHECK"] == "Y" && $arAllow["CUT_ANCHOR"] != "Y" && intval($arComments["AUTHOR_ID"]) > 0)
396 {
397 $authorityRatingId = CRatings::GetAuthorityRating();
398 $arRatingResult = CRatings::GetRatingResult($authorityRatingId, $arComments["AUTHOR_ID"]);
399 if($arRatingResult["CURRENT_VALUE"] < $arPathTemplate["NO_URL_IN_COMMENTS_AUTHORITY"])
400 $arAllow["CUT_ANCHOR"] = "Y";
401 }
402
403 $text = $parser->convert_to_rss($arComments["POST_TEXT"], $arImages, $arAllow, false, $arParserParams);
404
405 $title = GetMessage("BLG_GCM_COMMENT_TITLE", Array("#POST_TITLE#" => htmlspecialcharsEx($arPost["TITLE"]), "#COMMENT_AUTHOR#" => htmlspecialcharsEx($author)));
406 /*$title = str_replace(
407 array("&", "<", ">", "\""),
408 array("&amp;", "&lt;", "&gt;", "&quot;"),
409 $title);
410 */
411 //$text1 = HTMLToTxt($text, "", Array("\&nbsp;"), 60);
412 $text = "<![CDATA[".$text."]]>";
413
414
415 if ($type == "rss.92")
416 {
417 $rssText .= " <item>\n";
418 $rssText .= " <title>".$title."</title>\n";
419 $rssText .= " <description>".$text."</description>\n";
420 $rssText .= " <link>".$url1."</link>\n";
421 $rssText .= " </item>\n";
422 $rssText .= "\n";
423 }
424 elseif ($type == "rss2.0")
425 {
426 $rssText .= " <item>\n";
427 $rssText .= " <title>".$title."</title>\n";
428 $rssText .= " <description>".$text."</description>\n";
429 $rssText .= " <link>".$url1."</link>\n";
430 $rssText .= " <guid>".$url1."</guid>\n";
431 $rssText .= " <pubDate>".$date."</pubDate>\n";
432 $rssText .= " </item>\n";
433 $rssText .= "\n";
434 }
435 elseif ($type == "atom.03")
436 {
437 $atomID = "tag:".$serverName.":".$arBlog["URL"]."/".$arPost["ID"];
438
439 $timeISO = mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]);
440 $dateISO = date("Y-m-d\TH:i:s", $timeISO).mb_substr(date("O", $timeISO), 0, 3).":".mb_substr(date("O", $timeISO), -2, 2);
441
442 $rssText .= "<entry>\n";
443 $rssText .= " <title type=\"text/html\">".$title."</title>\n";
444 $rssText .= " <link rel=\"alternate\" type=\"text/html\" href=\"".$url1."\"/>\n";
445 $rssText .= " <issued>".$dateISO."</issued>\n";
446 $rssText .= " <modified>".$nowISO."</modified>\n";
447 $rssText .= " <id>".$atomID."</id>\n";
448 $rssText .= " <content type=\"text/html\" mode=\"escaped\" xml:lang=\"".$language."\" xml:base=\"".$blogURL."\">\n";
449 $rssText .= $text."\n";
450 $rssText .= " </content>\n";
451 $rssText .= " <author>\n";
452 $rssText .= " <name>".htmlspecialcharsex($author)."</name>\n";
453 if($authorURL <> '')
454 $rssText .= " <uri>".$authorURL."</uri>\n";
455 $rssText .= " </author>\n";
456 $rssText .= "</entry>\n";
457 $rssText .= "\n";
458 }
459 }
460 }
461
462 if ($type == "rss.92")
463 $rssText .= " </channel>\n</rss>";
464 elseif ($type == "rss2.0")
465 $rssText .= " </channel>\n</rss>";
466 elseif ($type == "atom.03")
467 $rssText .= "\n\n</feed>";
468 }
469 }
470 }
471
472 return $rssText;
473 }
474
475 public static function _IndexPostComments($arParams = Array())
476 {
477 if(intval($arParams["BLOG_ID"]) <= 0 || intval($arParams["POST_ID"]) <= 0 || !CModule::IncludeModule("search"))
478 return false;
479 if($arParams["USE_SOCNET"] == "Y")
481
482 $dbComment = CBlogComment::GetList(Array(), Array("BLOG_ID" => $arParams["BLOG_ID"], "POST_ID" => $arParams["POST_ID"], "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH), false, false, Array("ID", "POST_ID", "BLOG_ID", "PUBLISH_STATUS", "PATH", "DATE_CREATE", "POST_TEXT", "TITLE", "AUTHOR_ID"));
483 while($arComment = $dbComment->Fetch())
484 {
485 if($arComment["PATH"] <> '')
486 $arComment["PATH"] = str_replace("#comment_id#", $arComment["ID"], $arComment["PATH"]);
487 elseif($arParams["PATH"] <> '')
488 $arComment["PATH"] = str_replace("#comment_id#", $arComment["ID"], $arParams["PATH"]);
489 else
490 {
491 $arComment["PATH"] = CBlogPost::PreparePath(
492 $arParams["BLOG_URL"],
493 $arComment["POST_ID"],
494 $arParams["SITE_ID"],
495 false,
496 $arParams["OWNER_ID"],
497 $arParams["SOCNET_GROUP_ID"]
498 );
499 }
500
501 $arSearchIndex = array(
502 "SITE_ID" => array($arParams["SITE_ID"] => $arComment["PATH"]),
503 "LAST_MODIFIED" => $arComment["DATE_CREATE"],
504 "PARAM1" => "COMMENT",
505 "PARAM2" => $arComment["BLOG_ID"]."|".$arComment["POST_ID"],
506 "PERMISSIONS" => array(2),
507 "TITLE" => $arComment["TITLE"],
508 "BODY" => blogTextParser::killAllTags($arComment["POST_TEXT"]),
509 "INDEX_TITLE" => false,
510 "USER_ID" => (intval($arComment["AUTHOR_ID"]) > 0) ? $arComment["AUTHOR_ID"] : false,
511 "ENTITY_TYPE_ID" => "BLOG_COMMENT",
512 "ENTITY_ID" => $arComment["ID"],
513 );
514 if($arParams["USE_SOCNET"] == "Y")
515 {
516 $arSearchIndex["PERMISSIONS"] = $arSp;
517 if(!in_array("U".$arComment["AUTHOR_ID"], $arSearchIndex["PERMISSIONS"]))
518 $arSearchIndex["PERMISSIONS"][] = "U".$arComment["AUTHOR_ID"];
519
520 if(is_array($arSp))
521 {
522 $sgId = array();
523 foreach($arSp as $perm)
524 {
525 if(mb_strpos($perm, "SG") !== false)
526 {
527 $sgIdTmp = str_replace("SG", "", mb_substr($perm, 0, mb_strpos($perm, "_")));
528 if(!in_array($sgIdTmp, $sgId) && intval($sgIdTmp) > 0)
529 $sgId[] = $sgIdTmp;
530 }
531 }
532
533 if(!empty($sgId))
534 {
535 $arSearchIndex["PARAMS"] = array(
536 "socnet_group" => $sgId,
537 "entity" => "socnet_group",
538 );
539 }
540 }
541 }
542 if($arComment["TITLE"] == '')
543 $arSearchIndex["TITLE"] = mb_substr($arSearchIndex["BODY"], 0, 100);
544
545 CSearch::Index("blog", "C".$arComment["ID"], $arSearchIndex, True);
546 }
547
548 return true;
549 }
550
551 public static function UpdateLog($commentID, $arBlogUser, $arUser, $arComment, $arPost, $arParams)
552 {
553 if (!CModule::IncludeModule('socialnetwork'))
554 {
555 return;
556 }
557
558 $AuthorName = CBlogUser::GetUserName(
559 $arBlogUser["~ALIAS"] ?? null,
560 $arUser["~NAME"] ?? null,
561 $arUser["~LAST_NAME"] ?? null,
562 $arUser["~LOGIN"] ?? null,
563 $arUser["~SECOND_NAME"] ?? null
564 );
565 $parserBlog = new blogTextParser(false, $arParams["PATH_TO_SMILE"]);
566
567 $arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N");
568 $text4message = $parserBlog->convert($arComment["POST_TEXT"], false, $arParams["IMAGES"], $arAllow, array("isSonetLog"=>true));
569 $text4mail = $parserBlog->convert4mail($arComment["POST_TEXT"], $arParams["IMAGES"]);
570
571 $arSoFields = Array(
572 "TITLE_TEMPLATE" => htmlspecialcharsback($AuthorName)." ".GetMessage("BLG_SONET_COMMENT_TITLE"),
573 "TITLE" => $arPost['~TITLE'],
574 "MESSAGE" => $text4message,
575 "TEXT_MESSAGE" => $text4mail,
576 "TAG" => \Bitrix\Socialnetwork\Util::detectTags($arComment, array('POST_TEXT'))
577 );
578
580 array("ID" => "DESC"),
581 array(
582 "EVENT_ID" => array("blog_comment", "blog_comment_micro"),
583 "SOURCE_ID" => $commentID
584 ),
585 false,
586 false,
587 array("ID")
588 );
589 while ($arRes = $dbRes->Fetch())
590 {
591 CSocNetLogComments::Update($arRes["ID"], $arSoFields);
592 }
593 }
594
595 public static function DeleteLog($commentID)
596 {
597 if (!CModule::IncludeModule('socialnetwork'))
598 return;
599
601 array("ID" => "DESC"),
602 array(
603 "EVENT_ID" => array("blog_comment", "blog_comment_micro"),
604 "SOURCE_ID" => $commentID
605 ),
606 false,
607 false,
608 array("ID")
609 );
610 while ($arRes = $dbRes->Fetch())
612 }
613
614 public static function GetSocNetPostsPerms($entity_type, $entity_id)
615 {
616 global $DB;
617 $entity_id = intval($entity_id);
618
619 $type = "U";
620 $type2 = "US";
621 if($entity_type == "G")
622 $type = $type2 = "SG";
623
624 return $DB->Query("SELECT C.ID, C.POST_ID
625 FROM b_blog_comment C
626 INNER JOIN b_blog_socnet_rights SR ON (C.POST_ID = SR.POST_ID AND SR.ENTITY_TYPE='".$type."' AND SR.ENTITY_ID=".$entity_id." AND SR.ENTITY = '".$type2.$entity_id."')");
627 }
628
629 public static function GetSocNetCommentPerms($postID = 0)
630 {
631 $postID = intval($postID);
632 if($postID <= 0)
633 return false;
634
635 $arSp = Array();
636 $sp = CBlogPost::GetSocnetPerms($postID);
637 if(is_array($sp) && !empty($sp))
638 {
639 foreach($sp as $et => $v)
640 {
641 foreach($v as $eid => $tv)
642 {
643 if($et == "U" && in_array($et.$eid, $tv))
644 {
645 $arSp[] = $et.$eid;
646 }
647 elseif(in_array($et, Array("U", "SG")))
648 {
649 $spt = CBlogPost::GetSocnetGroups(($et == "SG" ? "G" : "U"), $eid, "view_comment");
650 foreach($spt as $vv)
651 {
652 if(!in_array($vv, $arSp))
653 $arSp[] = $vv;
654 }
655 }
656 else
657 {
658 $arSp[] = $et.$eid;
659 }
660 }
661 }
662 }
663 return $arSp;
664 }
665
666 public static function GetSocNetUserPerms($postId = 0, $authorId = 0, $userId = 0)
667 {
668 $permsBySG = false;
669 return self::GetSocNetUserPermsNew($postId, $authorId, $userId, $permsBySG);
670 }
671
672 public static function GetSocNetUserPermsNew($postId = 0, $authorId = 0, $userId = 0, &$permsBySG = null)
673 {
674 global $APPLICATION, $USER, $AR_BLOG_PERMS;
675
676 $bCurrent = false;
677 if ($permsBySG === null)
678 {
679 $permsBySG = false;
680 }
681
682 if (
683 !isset($userId)
684 || intval($userId) <= 0
685 )
686 {
687 $userId = intval($USER->GetID());
688 $bCurrent = true;
689 }
690
691 $postId = intval($postId);
692 $authorId = intval($authorId);
693 if ($postId <= 0)
694 {
695 return false;
696 }
697
698 $perms = BLOG_PERMS_DENY;
699
700 $blogModulePermissions = $APPLICATION->GetGroupRight("blog", ($bCurrent ? false : CUser::GetUserGroup($userId)));
701
702 if (
703 $blogModulePermissions >= "W"
704 || ($bCurrent ? CSocNetUser::IsCurrentUserModuleAdmin() : CSocNetUser::IsUserModuleAdmin($userId))
705 )
706 {
707 end($AR_BLOG_PERMS);
708 $perms = key($AR_BLOG_PERMS);
709 reset($AR_BLOG_PERMS);
710 }
711
712 $arPerms = CBlogPost::GetSocNetPerms($postId);
713 $arGroupsId = array();
714 if (
715 !empty($arPerms["SG"])
716 && is_array($arPerms["SG"])
717 )
718 {
719 foreach($arPerms["SG"] as $gid => $val)
720 {
721 //if(!empty($arEntities["SG"][$gid]))
722 $arGroupsId[] = $gid;
723 }
724 }
725
726 if (
727 empty($arGroupsId)
728 && $authorId > 0
729 && $userId == $authorId
730 )
731 {
732 $perms = BLOG_PERMS_MODERATE;
733 }
734
735 if($perms <= BLOG_PERMS_DENY)
736 {
737 $arEntities = Array();
738
739 if (!empty(CBlogPost::$arUACCache[$userId]))
740 {
741 $arEntities = CBlogPost::$arUACCache[$userId];
742 }
743 else
744 {
745 $arCodes = CAccess::GetUserCodesArray($userId);
746 foreach ($arCodes as $code)
747 {
748 if (
749 preg_match('/^DR([0-9]+)/', $code, $match)
750 || preg_match('/^D([0-9]+)/', $code, $match)
751 || preg_match('/^IU([0-9]+)/', $code, $match)
752 )
753 {
754 $arEntities["DR"][$code] = $code;
755 }
756 elseif (preg_match('/^SG([0-9]+)_([A-Z])/', $code, $match))
757 {
758 $arEntities["SG"][$match[1]][$match[2]] = $match[2];
759 }
760 }
761 CBlogPost::$arUACCache[$userId] = $arEntities;
762 }
763
764 if (!empty($arEntities["DR"]) && !empty($arPerms["DR"]))
765 {
766 foreach($arPerms["DR"] as $id => $val)
767 {
768 if(isset($arEntities["DR"]["DR".$id]))
769 {
770 $perms = BLOG_PERMS_READ;
771 break;
772 }
773 }
774 }
775
776 if($authorId <= 0)
777 {
778 foreach($arPerms["U"] as $id => $p)
779 {
780 if(in_array("US".$id, $p))
781 {
782 $authorId = $id;
783 break;
784 }
785 }
786 }
787
788 if (
789 $authorId > 0
790 && $userId == $authorId
791 )
792 {
793 $perms = BLOG_PERMS_READ;
794 }
795
796 if (
797 !empty($arPerms["U"][$userId])
798 || (
799 !empty($arPerms["U"][$authorId])
800 && in_array("US".$authorId, $arPerms["U"][$authorId])
801 )
802 || $perms == BLOG_PERMS_READ
803 )
804 {
805 if (CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $authorId, "blog", "write_comment"))
806 {
807 $perms = BLOG_PERMS_WRITE;
808 }
809 elseif (CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $authorId, "blog", "premoderate_comment"))
810 {
811 $perms = BLOG_PERMS_PREMODERATE;
812 }
813 elseif (CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $authorId, "blog", "view_comment"))
814 {
815 $perms = BLOG_PERMS_READ;
816 }
817 }
818
819 if (
820 $perms <= BLOG_PERMS_FULL
821 && !empty($arGroupsId)
822 )
823 {
824 $operation = Array("full_comment", "moderate_comment", "write_comment", "premoderate_comment");
825 if ($perms < BLOG_PERMS_READ)
826 {
827 $operation[] = "view_comment";
828 }
829
830 foreach ($operation as $v)
831 {
832 if ($perms <= BLOG_PERMS_READ)
833 {
834 $f = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_GROUP, $arGroupsId, "blog", $v);
835 if (
836 is_array($f)
837 && !empty($f)
838 )
839 {
840 foreach($f as $gid => $val)
841 {
842 if (
843 (
844 !empty($arEntities["SG"][$gid])
845 && in_array($val, $arEntities["SG"][$gid])
846 )
848 || (
849 $userId > 0
851 )
852 )
853 {
854 switch($v)
855 {
856 case "full_comment":
857 $perms = BLOG_PERMS_FULL;
858 $permsBySG = true;
859 break;
860 case "moderate_comment":
861 $perms = BLOG_PERMS_MODERATE;
862 $permsBySG = true;
863 break;
864 case "write_comment":
865 $perms = BLOG_PERMS_WRITE;
866 $permsBySG = true;
867 break;
868 case "premoderate_comment":
869 $perms = BLOG_PERMS_PREMODERATE;
870 $permsBySG = true;
871 break;
872 case "view_comment":
873 $perms = BLOG_PERMS_READ;
874 $permsBySG = true;
875 break;
876 }
877 }
878 }
879 }
880 }
881 }
882 }
883 }
884
885 return $perms;
886 }
887
888 public static function GetMentionedUserID($arFields)
889 {
890 $arMentionedUserID = array();
891
892 if (isset($arFields["POST_TEXT"]))
893 {
894 preg_match_all("/\[user\s*=\s*([^\]]*)\](.+?)\[\/user\]/isu", $arFields["POST_TEXT"], $arMention);
895 if (!empty($arMention))
896 {
897 $arMentionedUserID = array_merge($arMentionedUserID, $arMention[1]);
898 }
899 }
900
901 return $arMentionedUserID;
902 }
903
910 public static function addLiveComment($commentId = 0, $arParams = array())
911 {
912 global $USER_FIELD_MANAGER;
913
914 $res = "";
915 if(
916 $commentId > 0
917 && ($comment = CBlogComment::GetByID($commentId))
918 && ($arPost = CBlogPost::GetByID($comment["POST_ID"]))
919 )
920 {
921 global $DB, $APPLICATION;
922
923 $arParams["DATE_TIME_FORMAT"] = (isset($arParams["DATE_TIME_FORMAT"]) ? $arParams["DATE_TIME_FORMAT"] : $DB->DateFormatToPHP(CSite::GetDateFormat("FULL")));
924 $arParams["SHOW_RATING"] = (($arParams["SHOW_RATING"] ?? null) == "N" ? "N" : "Y");
925
926 $arParams["PATH_TO_USER"] = (isset($arParams["PATH_TO_USER"]) ? $arParams["PATH_TO_USER"] : '');
927 $arParams["PATH_TO_POST"] = (isset($arParams["PATH_TO_POST"]) ? $arParams["PATH_TO_POST"] : '');
928
929 $arParams["AVATAR_SIZE_COMMENT"] = ($arParams["AVATAR_SIZE_COMMENT"] ?? 0) > 0 ? $arParams["AVATAR_SIZE_COMMENT"] : 0;
930 if ($arParams["AVATAR_SIZE_COMMENT"] === 0)
931 {
932 $arParams["AVATAR_SIZE_COMMENT"] = (($arParams["AVATAR_SIZE"] ?? null) > 0 ? $arParams["AVATAR_SIZE"] : 100);
933 }
934
935 $arParams["NAME_TEMPLATE"] = isset($arParams["NAME_TEMPLATE"]) ? $arParams["NAME_TEMPLATE"] : CSite::GetNameFormat();
936 $arParams["SHOW_LOGIN"] = (($arParams["SHOW_LOGIN"] ?? null) == "N" ? "N" : "Y");
937
938 $comment["DateFormated"] = FormatDateFromDB($comment["DATE_CREATE"], $arParams["DATE_TIME_FORMAT"], true);
939 $timestamp = MakeTimeStamp($comment["DATE_CREATE"]);
940
941 if (
942 strcasecmp(LANGUAGE_ID, 'EN') !== 0
943 && strcasecmp(LANGUAGE_ID, 'DE') !== 0
944 )
945 {
946 $comment["DateFormated"] = mb_strtolower($comment["DateFormated"]);
947 }
948
949 $comment["UF"] = $USER_FIELD_MANAGER->GetUserFields("BLOG_COMMENT", $commentId, LANGUAGE_ID);
950
951 $arAuthor = CBlogUser::GetUserInfo(
952 $comment["AUTHOR_ID"],
953 $arParams["PATH_TO_USER"],
954 array(
955 "AVATAR_SIZE_COMMENT" => $arParams["AVATAR_SIZE_COMMENT"]
956 )
957 );
958
959 if (intval($arAuthor["PERSONAL_PHOTO"]) > 0)
960 {
961 $image_resize = CFile::ResizeImageGet(
962 $arAuthor["PERSONAL_PHOTO"],
963 array(
964 "width" => $arParams["AVATAR_SIZE_COMMENT"],
965 "height" => $arParams["AVATAR_SIZE_COMMENT"]
966 ),
968 );
969 $arAuthor["PERSONAL_PHOTO_RESIZED"] = array("src" => $image_resize["src"]);
970 }
971
972 $arAllow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "Y", "SHORT_ANCHOR" => "Y");
973 $arParserParams = Array(
974 "imageWidth" => 800,
975 "imageHeight" => 800,
976 "pathToUser" => $arParams["PATH_TO_USER"]
977 );
978 if (!empty($arParams["LOG_ID"]))
979 {
980 $arParserParams["pathToUserEntityType"] = 'LOG_ENTRY';
981 $arParserParams["pathToUserEntityId"] = intval($arParams["LOG_ID"]);
982 }
983
984 if ($commentAuxProvider = \Bitrix\Socialnetwork\CommentAux\Base::findProvider($comment))
985 {
986 $comment["AuxType"] = mb_strtolower($commentAuxProvider->getType());
987 $comment["TextFormated"] = $commentAuxProvider->getText();
988
989 $commentAuxProvider->setOptions(array(
990 'mobile' => true
991 ));
992 $comment["TextFormatedMobile"] = $commentAuxProvider->getText();
993 }
994 else
995 {
996 $p = new blogTextParser(false, '');
997 $ufCode = "UF_BLOG_COMMENT_FILE";
998 if (is_array($comment["UF"][$ufCode]))
999 {
1000 $p->arUserfields = array($ufCode => array_merge($comment["UF"][$ufCode], array("TAG" => "DOCUMENT ID")));
1001 }
1002
1003 $comment["TextFormated"] = $p->convert($comment["POST_TEXT"], false, array(), $arAllow, $arParserParams);
1004 $p->bMobile = true;
1005 $comment["TextFormatedMobile"] = $p->convert($comment["POST_TEXT"], false, array(), $arAllow, $arParserParams);
1006 }
1007
1008
1009 $comment["TextFormatedJS"] = CUtil::JSEscape(htmlspecialcharsBack($comment["POST_TEXT"]));
1010 $comment["TITLE"] = CUtil::JSEscape(htmlspecialcharsBack($comment["TITLE"]));
1011
1012 $authorType = false;
1013 if (
1014 isset($arAuthor["EXTERNAL_AUTH_ID"])
1015 && $arAuthor["EXTERNAL_AUTH_ID"] == 'email'
1016 )
1017 {
1018 $authorType = 'EMAIL';
1019 }
1020 elseif (
1021 IsModuleInstalled('extranet')
1022 && (
1023 empty($arAuthor["UF_DEPARTMENT"])
1024 || (
1025 is_array($arAuthor["UF_DEPARTMENT"])
1026 && empty($arAuthor["UF_DEPARTMENT"][0])
1027 )
1028 )
1029 )
1030 {
1031 $authorType = 'EXTRANET';
1032 }
1033
1034 $eventHandlerID = AddEventHandler("main", "system.field.view.file", Array("CSocNetLogTools", "logUFfileShow"));
1035 $res = $APPLICATION->IncludeComponent(
1036 "bitrix:main.post.list",
1037 "",
1038 array(
1039 "TEMPLATE_ID" => 'BLOG_COMMENT_BG_',
1040 "RATING_TYPE_ID" => ($arParams["SHOW_RATING"] == "Y" ? "BLOG_COMMENT" : ""),
1041 "ENTITY_XML_ID" => "BLOG_".$arPost["ID"],
1042 "RECORDS" => array(
1043 $commentId => array(
1044 "ID" => $comment["ID"],
1045 "RATING_VOTE_ID" => 'BLOG_COMMENT_'.$comment["ID"].'-'.(time()+rand(0, 1000)),
1046 "NEW" => (($arParams["FOLLOW"] ?? null) != "N" && ($comment["NEW"] ?? null) == "Y" ? "Y" : "N"),
1047 "AUX" => (!empty($arParams["AUX"]) ? $arParams["AUX"] : ''),
1048 "AUX_LIVE_PARAMS" => (!empty($arParams["AUX_LIVE_PARAMS"]) ? $arParams["AUX_LIVE_PARAMS"] : ''),
1049 "APPROVED" => ($comment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH ? "Y" : "N"),
1050 "POST_TIMESTAMP" => $timestamp,
1051 "POST_TIME" => $comment["DATE_CREATE_TIME"] ?? null,
1052 "POST_DATE" => $comment["DateFormated"],
1053 "AUTHOR" => array(
1054 "ID" => $arAuthor["ID"],
1055 "NAME" => $arAuthor["~NAME"],
1056 "LAST_NAME" => $arAuthor["~LAST_NAME"],
1057 "SECOND_NAME" => $arAuthor["~SECOND_NAME"],
1058 "LOGIN" => $arAuthor["~LOGIN"],
1059 "PERSONAL_GENDER" => $arAuthor["~PERSONAL_GENDER"],
1060 "AVATAR" => $arAuthor["PERSONAL_PHOTO_resized"]["src"] ?? null,
1061 "EXTERNAL_AUTH_ID" => (isset($arAuthor["EXTERNAL_AUTH_ID"]) ? $arAuthor["EXTERNAL_AUTH_ID"] : ''),
1062 "TYPE" => $authorType
1063 ),
1064 "FILES" => false,
1065 "UF" => $comment["UF"],
1066 "~POST_MESSAGE_TEXT" => $comment["POST_TEXT"],
1067 "WEB" => array(
1068 "POST_TIME" => $comment["DATE_CREATE_TIME"] ?? null,
1069 "POST_DATE" => $comment["DateFormated"],
1070 "CLASSNAME" => "",
1071 "POST_MESSAGE_TEXT" => $comment["TextFormated"],
1072 "AFTER" => <<<HTML
1073<script>top.text{$commentId} = text{$commentId} = '{$comment["TextFormatedJS"]}';top.title{$commentId} = title{$commentId} = '{$comment["TITLE"]}';top.arComFiles{$commentId} = [];</script>
1074HTML
1075 ),
1076 "MOBILE" => array(
1077 "POST_TIME" => $comment["DATE_CREATE_TIME"] ?? null,
1078 "POST_DATE" => $comment["DateFormated"],
1079 "CLASSNAME" => "",
1080 "POST_MESSAGE_TEXT" => $comment["TextFormatedMobile"]
1081 )
1082 )
1083 ),
1084 "NAV_STRING" => "",
1085 "NAV_RESULT" => "",
1086 "PREORDER" => "N",
1087 "RIGHTS" => array(
1088 "MODERATE" => "N",
1089 "EDIT" => "N",
1090 "DELETE" => "N"
1091 ),
1092 "VISIBLE_RECORDS_COUNT" => 1,
1093
1094 "ERROR_MESSAGE" => "",
1095 "OK_MESSAGE" => "",
1096 "RESULT" => $commentId,
1097 "PUSH&PULL" => array(
1098 "ACTION" => "REPLY",
1099 "ID" => $commentId,
1100 "AUTHOR_ID" => $arAuthor["ID"]
1101 ),
1102 "MODE" => (
1103 is_array($arParams) && isset($arParams["MODE"])
1104 ? $arParams["MODE"]
1105 : "PLAIN"
1106 ),
1107 "VIEW_URL" => (!empty($arParams["PATH_TO_POST"]) ? $arParams["PATH_TO_POST"] : ""),
1108 "EDIT_URL" => "",
1109 "MODERATE_URL" => "",
1110 "DELETE_URL" => "",
1111 "AUTHOR_URL" => "",
1112
1113 "AVATAR_SIZE" => $arParams["AVATAR_SIZE_COMMENT"],
1114 "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"],
1115 "SHOW_LOGIN" => $arParams["SHOW_LOGIN"],
1116
1117 "DATE_TIME_FORMAT" => "",
1118 "LAZYLOAD" => "",
1119
1120 "NOTIFY_TAG" => "",
1121 "NOTIFY_TEXT" => "",
1122 "SHOW_MINIMIZED" => "Y",
1123 "SHOW_POST_FORM" => (!empty($arParams["CAN_USER_COMMENT"]) && $arParams["CAN_USER_COMMENT"] ? "Y" : "N"),
1124
1125 "IMAGE_SIZE" => "",
1126 "mfi" => "",
1127 'CURRENT_USER_ID' => (isset($arParams['CURRENT_USER_ID']) ? (int)$arParams['CURRENT_USER_ID'] : 0),
1128 ),
1129 array(),
1130 null
1131 );
1132 if (
1133 $eventHandlerID !== false
1134 && intval($eventHandlerID) > 0
1135 )
1136 {
1137 RemoveEventHandler('main', 'system.field.view.file', $eventHandlerID);
1138 }
1139 }
1140 return $res;
1141 }
1142
1143 public static function BuildUFFields($arUF)
1144 {
1145 global $APPLICATION;
1146
1147 $arResult = array(
1148 "AFTER" => "",
1149 "AFTER_MOBILE" => ""
1150 );
1151
1152 if (
1153 is_array($arUF)
1154 && count($arUF) > 0
1155 )
1156 {
1157 ob_start();
1158
1159 $eventHandlerID = AddEventHandler("main", "system.field.view.file", Array("CSocNetLogTools", "logUFfileShow"));
1160
1161 foreach ($arUF as $FIELD_NAME => $arUserField)
1162 {
1163 if(!empty($arUserField["VALUE"]))
1164 {
1165 $APPLICATION->IncludeComponent(
1166 "bitrix:system.field.view",
1167 $arUserField["USER_TYPE"]["USER_TYPE_ID"],
1168 array(
1169 "arUserField" => $arUserField,
1170 "MOBILE" => "Y"
1171 ),
1172 null,
1173 array("HIDE_ICONS"=>"Y")
1174 );
1175 }
1176 }
1177 if (
1178 $eventHandlerID !== false
1179 && intval($eventHandlerID) > 0
1180 )
1181 {
1182 RemoveEventHandler('main', 'system.field.view.file', $eventHandlerID);
1183 }
1184
1185 $arResult["AFTER_MOBILE"] = ob_get_clean();
1186
1187 ob_start();
1188
1189 $eventHandlerID = AddEventHandler("main", "system.field.view.file", Array("CSocNetLogTools", "logUFfileShow"));
1190
1191 foreach ($arUF as $FIELD_NAME => $arUserField)
1192 {
1193 if(!empty($arUserField["VALUE"]))
1194 {
1195 $APPLICATION->IncludeComponent(
1196 "bitrix:system.field.view",
1197 $arUserField["USER_TYPE"]["USER_TYPE_ID"],
1198 array(
1199 "arUserField" => $arUserField
1200 ),
1201 null,
1202 array("HIDE_ICONS"=>"Y")
1203 );
1204 }
1205 }
1206 if (
1207 $eventHandlerID !== false
1208 && intval($eventHandlerID) > 0
1209 )
1210 {
1211 RemoveEventHandler('main', 'system.field.view.file', $eventHandlerID);
1212 }
1213
1214 $arResult["AFTER"] .= ob_get_clean();
1215 }
1216
1217 return $arResult;
1218 }
1219}
$arParams
Определения access_dialog.php:21
$type
Определения options.php:106
const BLOG_PERMS_MODERATE
Определения include.php:9
const BLOG_BY_USER_ID
Определения include.php:55
const BLOG_PERMS_DENY
Определения include.php:5
const BLOG_PERMS_WRITE
Определения include.php:8
const BLOG_PERMS_READ
Определения include.php:6
const BLOG_PERMS_FULL
Определения include.php:10
const BLOG_PUBLISH_STATUS_PUBLISH
Определения include.php:47
const BLOG_PERMS_PREMODERATE
Определения include.php:7
global $APPLICATION
Определения include.php:80
$arResult
Определения generate_coupon.php:16
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static encode($text)
Определения emoji.php:17
static encode($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения htmlfilter.php:12
Определения blog_comment.php:8
static DeleteLog($commentID)
Определения blog_comment.php:595
static UpdateLog($commentID, $arBlogUser, $arUser, $arComment, $arPost, $arParams)
Определения blog_comment.php:551
static Delete($ID)
Определения blog_comment.php:110
static addLiveComment($commentId=0, $arParams=array())
Определения blog_comment.php:910
static GetByID($ID)
Определения blog_comment.php:170
static BuildRSS($postID, $blogID, $type="RSS2.0", $numPosts=10, $arPathTemplate=Array())
Определения blog_comment.php:200
static GetSocNetCommentPerms($postID=0)
Определения blog_comment.php:629
static CheckFields($ACTION, &$arFields, $ID=0)
Определения blog_comment.php:11
const UF_NAME
Определения blog_comment.php:9
static GetMentionedUserID($arFields)
Определения blog_comment.php:888
static _IndexPostComments($arParams=Array())
Определения blog_comment.php:475
static GetSocNetUserPerms($postId=0, $authorId=0, $userId=0)
Определения blog_comment.php:666
static GetSocNetPostsPerms($entity_type, $entity_id)
Определения blog_comment.php:614
static GetSocNetUserPermsNew($postId=0, $authorId=0, $userId=0, &$permsBySG=null)
Определения blog_comment.php:672
static BuildUFFields($arUF)
Определения blog_comment.php:1143
static GetByID($ID)
Определения blog_group.php:64
static GetByID($ID)
Определения blog.php:931
static PreparePath($blogUrl, $siteID=False, $is404=True, $userID=0, $groupID=0)
Определения blog.php:1453
static Delete($ID)
Определения blog_image.php:143
static GetBlogUserCommentPerms($id, $userId)
Определения blog_post.php:157
static GetPostID($postID, $code, $allowCode=false)
Определения blog_post.php:1219
static $arUACCache
Определения blog_post.php:13
static PreparePath($blogUrl, $postID=0, $siteID=False, $is404=True, $userID=0, $groupID=0)
Определения blog_post.php:620
static GetSocNetPostPerms( $postId=0, $bNeedFull=false, $userId=false, $postAuthor=0)
Определения blog_post.php:1623
static GetUserName($alias, $name, $lastName, $login, $secondName="")
Определения blog_user.php:569
static GetUserInfo($id, $path, $arParams=array())
Определения blog_user.php:638
static PreparePath($userID=0, $siteID=False, $is404=True)
Определения blog_user.php:579
static GetByID($ID, $selectType=BLOG_BY_BLOG_USER_ID)
Определения blog_user.php:354
static Index($MODULE_ID, $ITEM_ID, $arFields, $bOverWrite=false, $SEARCH_SESS_ID='')
Определения search.php:1302
static Delete($ID, $bSetSource=false)
Определения log_comments.php:161
static GetList($arOrder=Array("ID"=> "DESC"), $arFilter=Array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения blog_comment.php:334
static GetList($arOrder=Array("ID"=> "DESC"), $arFilter=Array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения blog_image.php:122
static GetByID($ID)
Определения blog_post.php:511
static Update($ID, $arFields, $bSearchIndex=true)
Определения blog_post.php:224
static GetAuthorityRating()
Определения ratings.php:1475
static GetRatingResult($ID, $entityId)
Определения ratings.php:729
static GetList($arOrder=Array("ID"=> "DESC"), $arFilter=Array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array(), $arParams=array())
Определения log_comments.php:519
static Update($ID, $arFields, $bSetSource=false)
Определения log_comments.php:307
Определения functions.php:6
static killAllTags($text)
Определения functions.php:473
$f
Определения component_props.php:52
$arFields
Определения dblapprove.php:5
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
bx_acc_lim_group_list limitGroupList[] multiple<?=$group[ 'ID']?> ID selected margin top
Определения file_new.php:657
$res
Определения filter_act.php:7
$perm
Определения options.php:169
global $USER_FIELD_MANAGER
Определения attempt.php:6
$GLOBALS["BLOG_COMMENT"]
Определения blog_comment.php:5
if($ajaxMode) $ID
Определения get_user.php:27
$p
Определения group_list_element_edit.php:23
global $DB
Определения cron_frame.php:29
global $USER
Определения csv_new_run.php:40
$ACTION
Определения csv_new_setup.php:27
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения options.php:195
const BX_RESIZE_IMAGE_EXACT
Определения constants.php:12
const SITE_CHARSET
Определения include.php:62
$arCodes
Определения options.php:154
ExecuteModuleEventEx($arEvent, $arParams=[])
Определения tools.php:5214
htmlspecialcharsback($str)
Определения tools.php:2693
IsModuleInstalled($module_id)
Определения tools.php:5301
ParseDateTime($datetime, $format=false)
Определения tools.php:638
AddEventHandler($FROM_MODULE_ID, $MESSAGE_ID, $CALLBACK, $SORT=100, $FULL_PATH=false)
Определения tools.php:5165
htmlspecialcharsEx($str)
Определения tools.php:2685
GetModuleEvents($MODULE_ID, $MESSAGE_ID, $bReturnArray=false)
Определения tools.php:5177
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
is_set($a, $k=false)
Определения tools.php:2133
GetMessage($name, $aReplace=null)
Определения tools.php:3397
check_email($email, $strict=false, $domainCheck=false)
Определения tools.php:4571
FormatDateFromDB($date, $format='FULL', $phpFormat=false)
Определения tools.php:1875
MakeTimeStamp($datetime, $format=false)
Определения tools.php:538
RemoveEventHandler($FROM_MODULE_ID, $MESSAGE_ID, $iEventHandlerKey)
Определения tools.php:5171
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
<? endif;?> window document title
Определения prolog_main_admin.php:76
$text
Определения template_pdf.php:79
$dateISO
Определения result_rec.php:112
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$comment
Определения template.php:15
$title
Определения pdf.php:123
$val
Определения options.php:1793
const SONET_ENTITY_GROUP
Определения include.php:117
const SONET_ROLES_AUTHORIZED
Определения include.php:36
const SONET_ENTITY_USER
Определения include.php:118
const SONET_ROLES_ALL
Определения include.php:35
$arRes
Определения options.php:104
const SITE_ID
Определения sonet_set_content_view.php:12
$GLOBALS['_____370096793']
Определения update_client.php:1
$dbResult
Определения updtr957.php:3
$url
Определения iframe.php:7
$dbRes
Определения yandex_detail.php:168