1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
blog.php
См. документацию.
1<?php
2
4
5$GLOBALS["BLOG"] = Array();
6
8
10{
11 public static function IsBlogOwner($ID, $userID)
12 {
13 $ID = intval($ID);
14 $userID = intval($userID);
15 if ($userID <= 0)
16 return False;
17
18 $arBlog = CBlog::GetByID($ID);
19 if ($arBlog)
20 {
21 if (intval($arBlog["OWNER_ID"]) == $userID && $arBlog["ACTIVE"] == "Y")
22 return True;
23 }
24 return False;
25 }
26
27 public static function CanUserCreateBlog($userID = 0)
28 {
29 global $APPLICATION;
30 $userID = intval($userID);
31
32 if ($userID > 0 && CBlogUser::IsLocked($userID))
33 return False;
34
35 $arGroups = false;
36 if($userID > 0)
37 $arGroups = CUser::GetUserGroup($userID);
38
39 $blogModulePermissions = $APPLICATION->GetGroupRight("blog", $arGroups);
40 if ($blogModulePermissions >= "N")
41 return True;
42
43 return False;
44// return True;
45 }
46
47 public static function CanUserViewBlogs($arUserGroups = array())
48 {
49 /*
50 $blogModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("blog");
51 if ($blogModulePermissions >= "K")
52 return True;
53
54 return False;
55 */
56 return True;
57 }
58
59 public static function CanUserManageBlog($ID, $userID = 0)
60 {
61 global $APPLICATION;
62 $ID = intval($ID);
63 $userID = intval($userID);
64
65 if ($userID <= 0)
66 return False;
67
68 $blogModulePermissions = $APPLICATION->GetGroupRight("blog");
69 if ($blogModulePermissions >= "W")
70 return True;
71
72 if (CBlog::IsBlogOwner($ID, $userID))
73 return True;
74
75 return False;
76 }
77
78 public static function GetBlogUserPostPerms($ID, $userID = 0)
79 {
80 global $APPLICATION;
81 $ID = intval($ID);
82 $userID = intval($userID);
83
84 $arAvailPerms = array_keys($GLOBALS["AR_BLOG_PERMS"]);
85
86 $blogModulePermissions = $APPLICATION->GetGroupRight("blog");
87 if ($blogModulePermissions >= "W")
88 return $arAvailPerms[count($arAvailPerms) - 1];
89
90 if (CBlog::IsBlogOwner($ID, $userID))
91 return $arAvailPerms[count($arAvailPerms) - 1];
92
93 $arUserGroups = CBlogUser::GetUserGroups($userID, $ID, "Y", BLOG_BY_USER_ID);
94 $permGroups = CBlogUser::GetUserPerms($arUserGroups, $ID, 0, BLOG_PERMS_POST, BLOG_BY_USER_ID);
95
96// if for user unset option "WRITE TO BLOG", they can only read (even if all user can write), or smaller rights, if group have smaller
97 $arBlogUser = CBlogUser::GetByID($userID, BLOG_BY_USER_ID);
98 if ($arBlogUser && $arBlogUser["ALLOW_POST"] != "Y")
99 {
100 if($permGroups && in_array(BLOG_PERMS_READ, $arAvailPerms))
101 return min(BLOG_PERMS_READ, $permGroups);
102 else
103 return $arAvailPerms[0];
104 }
105
106 if ($permGroups)
107 return $permGroups;
108
109 return $arAvailPerms[0];
110 }
111
112 public static function GetBlogUserCommentPerms($ID, $userID)
113 {
114 global $APPLICATION;
115 $ID = intval($ID);
116 $userID = intval($userID);
117
118 $arAvailPerms = array_keys($GLOBALS["AR_BLOG_PERMS"]);
119
120 $blogModulePermissions = $APPLICATION->GetGroupRight("blog");
121 if ($blogModulePermissions >= "W")
122 return $arAvailPerms[count($arAvailPerms) - 1];
123
124 if (CBlog::IsBlogOwner($ID, $userID))
125 return $arAvailPerms[count($arAvailPerms) - 1];
126
127 $arBlog = CBlog::GetByID($ID);
128 if ($arBlog["ENABLE_COMMENTS"] != "Y")
129 return $arAvailPerms[0];
130
131 $arBlogUser = CBlogUser::GetByID($userID, BLOG_BY_USER_ID);
132 if ($arBlogUser && $arBlogUser["ALLOW_POST"] != "Y")
133 return $arAvailPerms[0];
134
135 $arUserGroups = CBlogUser::GetUserGroups($userID, $ID, "Y", BLOG_BY_USER_ID);
136
138 if ($perms)
139 return $perms;
140
141 return $arAvailPerms[0];
142 }
143
144 /*************** ADD, UPDATE, DELETE *****************/
145 public static function CheckFields($ACTION, &$arFields, $ID = 0)
146 {
147 global $APPLICATION, $DB;
148
149 if ((is_set($arFields, "NAME") || $ACTION=="ADD") && $arFields["NAME"] == '')
150 {
151 $APPLICATION->ThrowException(GetMessage("BLG_GB_EMPTY_NAME"), "EMPTY_NAME");
152 return false;
153 }
154 /*
155 elseif (is_set($arFields, "NAME"))
156 {
157 $dbResult = CBlog::GetList(array(), array("NAME" => $arFields["NAME"], "!ID" => $ID), false, false, array("ID"));
158 if ($dbResult->Fetch())
159 {
160 $APPLICATION->ThrowException(GetMessage("BLG_GB_DUBLICATE_NAME"), "DUBLICATE_NAME");
161 return false;
162 }
163 }
164 */
165
166 if ((is_set($arFields, "URL") || $ACTION=="ADD") && $arFields["URL"] == '')
167 {
168 $APPLICATION->ThrowException(GetMessage("BLG_GB_EMPTY_URL"), "EMPTY_URL");
169 return false;
170 }
171 elseif (is_set($arFields, "URL"))
172 {
173 $urlCheck = preg_replace("/[^a-zA-Z0-9_-]/is", "", $arFields["URL"]);
174 if ($urlCheck != $arFields["URL"])
175 {
176 $APPLICATION->ThrowException(GetMessage("BLG_GB_BAD_URL"), "BAD_URL");
177 return false;
178 }
179
180 $dbResult = CBlog::GetList(array(), array("URL" => $arFields["URL"], "!ID" => $ID), false, false, array("ID"));
181 if ($dbResult->Fetch())
182 {
183 $APPLICATION->ThrowException(GetMessage("BLG_GB_DUBLICATE_URL"), "DUBLICATE_URL");
184 return false;
185 }
186
187 if (in_array(mb_strtolower($arFields["URL"]), $GLOBALS["AR_BLOG_RESERVED_NAMES"]))
188 {
189 $APPLICATION->ThrowException(str_replace("#NAME#", $arFields["URL"], GetMessage("BLG_GB_RESERVED_NAME")), "RESERVED_NAME");
190 return false;
191 }
192 }
193
194 if (is_set($arFields, "DATE_CREATE") && (!$DB->IsDate($arFields["DATE_CREATE"], false, LANG, "FULL")))
195 {
196 $APPLICATION->ThrowException(GetMessage("BLG_GB_EMPTY_DATE_CREATE"), "EMPTY_DATE_CREATE");
197 return false;
198 }
199
200 if (is_set($arFields, "DATE_UPDATE") && (!$DB->IsDate($arFields["DATE_UPDATE"], false, LANG, "FULL")))
201 {
202 $APPLICATION->ThrowException(GetMessage("BLG_GB_EMPTY_DATE_UPDATE"), "EMPTY_DATE_UPDATE");
203 return false;
204 }
205
206 if (is_set($arFields, "LAST_POST_DATE") && (!$DB->IsDate($arFields["LAST_POST_DATE"], false, LANG, "FULL") && $arFields["LAST_POST_DATE"] <> ''))
207 {
208 $APPLICATION->ThrowException(GetMessage("BLG_GB_EMPTY_LAST_POST_DATE"), "EMPTY_LAST_POST_DATE");
209 return false;
210 }
211
212 if($ACTION=="ADD" && (intval($arFields["OWNER_ID"]) <= 0 && intval($arFields["SOCNET_GROUP_ID"]) <= 0))
213 {
214 $APPLICATION->ThrowException(GetMessage("BLG_GB_EMPTY_OWNER_ID"), "EMPTY_OWNER_ID");
215 return false;
216 }
217
218 if (intval($arFields["OWNER_ID"] ?? 0) > 0)
219 {
220 $dbResult = CUser::GetByID($arFields["OWNER_ID"]);
221 if (!$dbResult->Fetch())
222 {
223 $APPLICATION->ThrowException(GetMessage("BLG_GB_ERROR_NO_OWNER_ID"), "ERROR_NO_OWNER_ID");
224 return false;
225 }
226 }
227
228 if(is_set($arFields, "OWNER_ID") && is_set($arFields, "SOCNET_GROUP_ID") && intval($arFields["OWNER_ID"]) <= 0 && intval($arFields["SOCNET_GROUP_ID"]) <= 0)
229 {
230 $APPLICATION->ThrowException(GetMessage("BLG_GB_EMPTY_OWNER_ID"), "EMPTY_OWNER_ID");
231 return false;
232 }
233
234 if ((is_set($arFields, "GROUP_ID") || $ACTION=="ADD") && intval($arFields["GROUP_ID"]) <= 0)
235 {
236 $APPLICATION->ThrowException(GetMessage("BLG_GB_EMPTY_GROUP_ID"), "EMPTY_GROUP_ID");
237 return false;
238 }
239 elseif (is_set($arFields, "GROUP_ID"))
240 {
242 if (!$dbResult)
243 {
244 $APPLICATION->ThrowException(GetMessage("BLG_GB_ERROR_NO_GROUP_ID"), "ERROR_NO_GROUP_ID");
245 return false;
246 }
247 }
248
249 if ((is_set($arFields, "ACTIVE") || $ACTION=="ADD") && $arFields["ACTIVE"] != "Y" && $arFields["ACTIVE"] != "N")
250 $arFields["ACTIVE"] = "Y";
251 if ((is_set($arFields, "ENABLE_COMMENTS") || $ACTION=="ADD") && $arFields["ENABLE_COMMENTS"] != "Y" && $arFields["ENABLE_COMMENTS"] != "N")
252 $arFields["ENABLE_COMMENTS"] = "Y";
253 if ((is_set($arFields, "ENABLE_IMG_VERIF") || $ACTION=="ADD") && $arFields["ENABLE_IMG_VERIF"] != "Y" && $arFields["ENABLE_IMG_VERIF"] != "N")
254 $arFields["ENABLE_IMG_VERIF"] = "N";
255 if ((is_set($arFields, "ENABLE_RSS") || $ACTION=="ADD") && $arFields["ENABLE_RSS"] != "Y" && $arFields["ENABLE_RSS"] != "N")
256 $arFields["ENABLE_RSS"] = "N";
257 if ((is_set($arFields, "ALLOW_HTML") || $ACTION=="ADD") && $arFields["ALLOW_HTML"] != "Y" && $arFields["ALLOW_HTML"] != "N")
258 $arFields["ALLOW_HTML"] = "N";
259 if ((is_set($arFields, "USE_SOCNET") || $ACTION=="ADD") && $arFields["USE_SOCNET"] != "Y" && $arFields["USE_SOCNET"] != "N")
260 $arFields["USE_SOCNET"] = "N";
261
262
263 return True;
264 }
265
266 public static function Delete($ID)
267 {
268 global $DB;
269
270 $ID = intval($ID);
271 $bSuccess = True;
272
273 foreach(GetModuleEvents("blog", "OnBeforeBlogDelete", true) as $arEvent)
274 {
275 if (ExecuteModuleEventEx($arEvent, Array($ID))===false)
276 return false;
277 }
278
279 foreach(GetModuleEvents("blog", "OnBlogDelete", true) as $arEvent)
280 {
281 ExecuteModuleEventEx($arEvent, Array($ID));
282 }
283
284 $arBlog = CBlog::GetByID($ID);
285
286 $DB->StartTransaction();
287
288 if ($bSuccess)
289 $bSuccess = $DB->Query("DELETE FROM b_blog_user2blog WHERE BLOG_ID = ".$ID."", true);
290 if ($bSuccess)
291 $bSuccess = $DB->Query("DELETE FROM b_blog_user_group_perms WHERE BLOG_ID = ".$ID."", true);
292 if ($bSuccess)
293 $bSuccess = $DB->Query("DELETE FROM b_blog_user2user_group WHERE BLOG_ID = ".$ID."", true);
294 if ($bSuccess)
295 $bSuccess = $DB->Query("DELETE FROM b_blog_user_group WHERE BLOG_ID = ".$ID."", true);
296 if ($bSuccess)
297 $bSuccess = $DB->Query("DELETE FROM b_blog_trackback WHERE BLOG_ID = ".$ID."", true);
298 if ($bSuccess)
299 $bSuccess = $DB->Query("DELETE FROM b_blog_comment WHERE BLOG_ID = ".$ID."", true);
300 if ($bSuccess)
301 $bSuccess = $DB->Query("DELETE FROM b_blog_post WHERE BLOG_ID = ".$ID."", true);
302 if ($bSuccess)
303 $bSuccess = $DB->Query("DELETE FROM b_blog_category WHERE BLOG_ID = ".$ID."", true);
304
305 if ($bSuccess)
306 {
307 unset($GLOBALS["BLOG"]["BLOG_CACHE_".$ID]);
308 unset($GLOBALS["BLOG"]["BLOG4OWNER_CACHE_".$arBlog["OWNER_ID"]]);
309 }
310
311 if ($bSuccess)
312 $bSuccess = $DB->Query("DELETE FROM b_blog WHERE ID = ".$ID."", true);
313
314 if ($bSuccess)
315 $DB->Commit();
316 else
317 $DB->Rollback();
318
319 if ($bSuccess)
320 {
321 if (CModule::IncludeModule("search"))
322 {
323 CSearch::DeleteIndex("blog", false, "COMMENT", $ID."|%");
324 CSearch::DeleteIndex("blog", false, "POST", $ID);
325 CSearch::DeleteIndex("blog", "B".$ID);
326 }
327 }
328
329 if ($bSuccess)
330 {
331 $res = CBlogImage::GetList(array(), array("BLOG_ID"=>$ID));
332 while($aImg = $res->Fetch())
333 CBlogImage::Delete($aImg['ID']);
334 }
335 if ($bSuccess)
336 $GLOBALS["USER_FIELD_MANAGER"]->Delete("BLOG_BLOG", $ID);
337
339
340 return $bSuccess;
341 }
342
343 public static function SetBlogPerms($ID, $arPerms = array(), $permsType = BLOG_PERMS_POST)
344 {
345 $ID = intval($ID);
346 $permsType = (($permsType == BLOG_PERMS_COMMENT) ? BLOG_PERMS_COMMENT : BLOG_PERMS_POST);
347
348 $arBlog = CBlog::GetByID($ID);
349 if ($arBlog)
350 {
351 foreach ($arPerms as $key => $value)
352 {
353 $dbGroupPerms = CBlogUserGroupPerms::GetList(
354 array(),
355 array(
356 "BLOG_ID" => $ID,
357 "USER_GROUP_ID" => $key,
358 "PERMS_TYPE" => $permsType,
359 "POST_ID" => 0
360 ),
361 false,
362 false,
363 array("ID")
364 );
365 if ($arGroupPerms = $dbGroupPerms->Fetch())
366 {
368 $arGroupPerms["ID"],
369 array("PERMS" => $value)
370 );
371 }
372 else
373 {
375 array(
376 "BLOG_ID" => $arBlog["ID"],
377 "USER_GROUP_ID" => $key,
378 "PERMS_TYPE" => $permsType,
379 "POST_ID" => false,
380 "AUTOSET" => "N",
381 "PERMS" => $value
382 )
383 );
384 }
385 }
386 }
387 }
388
389 public static function SetStat($ID)
390 {
391 global $DB;
392 $ID = intval($ID);
393
394 CTimeZone::Disable();
395 $dbBlogPost = CBlogPost::GetList(
396 array("DATE_PUBLISH" => "DESC"),
397 array(
398 "BLOG_ID" => $ID,
399 "<=DATE_PUBLISH" => ConvertTimeStamp(false, "FULL", false),
400 "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH
401 ),
402 false,
403 array("nTopCount" => 1),
404 array("ID", "DATE_PUBLISH")
405 );
406 CTimeZone::Enable();
407
408 if ($arBlogPost = $dbBlogPost->Fetch())
409 {
411 "LAST_POST_ID" => $arBlogPost["ID"],
412 "LAST_POST_DATE" => $arBlogPost["DATE_PUBLISH"],
413 "=DATE_UPDATE" => $DB->CurrentTimeFunction()
414 );
415 }
416 else
417 {
419 "LAST_POST_ID" => false,
420 "LAST_POST_DATE" => false,
421 "=DATE_UPDATE" => $DB->CurrentTimeFunction()
422 );
423 }
425 }
426
427 //*************** COMMON UTILS *********************/
428 public static function GetFilterOperation($key)
429 {
430 $strNegative = "N";
431 if (mb_substr($key, 0, 1) == "!")
432 {
433 $key = mb_substr($key, 1);
434 $strNegative = "Y";
435 }
436
437 $strOrNull = "N";
438 if (mb_substr($key, 0, 1) == "+")
439 {
440 $key = mb_substr($key, 1);
441 $strOrNull = "Y";
442 }
443
444 if (mb_substr($key, 0, 2) == ">=")
445 {
446 $key = mb_substr($key, 2);
447 $strOperation = ">=";
448 }
449 elseif (mb_substr($key, 0, 1) == ">")
450 {
451 $key = mb_substr($key, 1);
452 $strOperation = ">";
453 }
454 elseif (mb_substr($key, 0, 2) == "<=")
455 {
456 $key = mb_substr($key, 2);
457 $strOperation = "<=";
458 }
459 elseif (mb_substr($key, 0, 1) == "<")
460 {
461 $key = mb_substr($key, 1);
462 $strOperation = "<";
463 }
464 elseif (mb_substr($key, 0, 1) == "@")
465 {
466 $key = mb_substr($key, 1);
467 $strOperation = "IN";
468 }
469 elseif (mb_substr($key, 0, 1) == "~")
470 {
471 $key = mb_substr($key, 1);
472 $strOperation = "LIKE";
473 }
474 elseif (mb_substr($key, 0, 1) == "%")
475 {
476 $key = mb_substr($key, 1);
477 $strOperation = "QUERY";
478 }
479 else
480 {
481 $strOperation = "=";
482 }
483
484 return array("FIELD" => $key, "NEGATIVE" => $strNegative, "OPERATION" => $strOperation, "OR_NULL" => $strOrNull);
485 }
486
487 public static function PrepareSql(&$arFields, $arOrder, &$arFilter, $arGroupBy, $arSelectFields, $obUserFieldsSql = false)
488 {
489 global $DB;
490
491 $strSqlSelect = "";
492 $strSqlFrom = "";
493 $strSqlWhere = "";
494 $strSqlGroupBy = "";
495 $strSqlOrderBy = "";
496
497 $arGroupByFunct = array("COUNT", "AVG", "MIN", "MAX", "SUM");
498
499 $arAlreadyJoined = array();
500
501 // GROUP BY -->
502 if (is_array($arGroupBy) && count($arGroupBy)>0)
503 {
504 $arSelectFields = $arGroupBy;
505 foreach ($arGroupBy as $key => $val)
506 {
507 $val = mb_strtoupper($val);
508 $key = mb_strtoupper($key);
509 if (array_key_exists($val, $arFields) && !in_array($key, $arGroupByFunct))
510 {
511 if ($strSqlGroupBy <> '')
512 $strSqlGroupBy .= ", ";
513 $strSqlGroupBy .= $arFields[$val]["FIELD"];
514
515 if (isset($arFields[$val]["FROM"])
516 && $arFields[$val]["FROM"] <> ''
517 && !in_array($arFields[$val]["FROM"], $arAlreadyJoined))
518 {
519 if ($strSqlFrom <> '')
520 $strSqlFrom .= " ";
521 $strSqlFrom .= $arFields[$val]["FROM"];
522 $arAlreadyJoined[] = $arFields[$val]["FROM"];
523 }
524 }
525 }
526 }
527 // <-- GROUP BY
528
529 // SELECT -->
530 $arFieldsKeys = array_keys($arFields);
531
532 if (is_array($arGroupBy) && count($arGroupBy)==0)
533 {
534 $strSqlSelect = "COUNT(%%_DISTINCT_%% ".$arFields[$arFieldsKeys[0]]["FIELD"].") as CNT ";
535 }
536 else
537 {
538 if (isset($arSelectFields) && !is_array($arSelectFields) && is_string($arSelectFields) && $arSelectFields <> '' && array_key_exists($arSelectFields, $arFields))
539 $arSelectFields = array($arSelectFields);
540
541 if (!isset($arSelectFields)
542 || !is_array($arSelectFields)
543 || count($arSelectFields)<=0
544 || in_array("*", $arSelectFields))
545 {
546 foreach($arFieldsKeys as $fkey)
547 {
548 if (isset($arFields[$fkey]["WHERE_ONLY"]) && $arFields[$fkey]["WHERE_ONLY"] == "Y")
549 continue;
550
551 if ($strSqlSelect <> '')
552 $strSqlSelect .= ", ";
553
554 if ($arFields[$fkey]["TYPE"] == "datetime")
555 {
556 if (array_key_exists($fkey, $arOrder))
557 $strSqlSelect .= $arFields[$fkey]["FIELD"]." as ".$fkey."_X1, ";
558
559 $strSqlSelect .= $DB->DateToCharFunction($arFields[$fkey]["FIELD"], "FULL")." as ".$fkey;
560 }
561 elseif ($arFields[$fkey]["TYPE"] == "date")
562 {
563 if (array_key_exists($fkey, $arOrder))
564 $strSqlSelect .= $arFields[$fkey]["FIELD"]." as ".$fkey."_X1, ";
565
566 $strSqlSelect .= $DB->DateToCharFunction($arFields[$fkey]["FIELD"], "SHORT")." as ".$fkey;
567 }
568 else
569 $strSqlSelect .= $arFields[$fkey]["FIELD"]." as ".$fkey;
570
571 if (isset($arFields[$fkey]["FROM"])
572 && $arFields[$fkey]["FROM"] <> ''
573 && !in_array($arFields[$fkey]["FROM"], $arAlreadyJoined))
574 {
575 if ($strSqlFrom <> '')
576 $strSqlFrom .= " ";
577 $strSqlFrom .= $arFields[$fkey]["FROM"];
578 $arAlreadyJoined[] = $arFields[$fkey]["FROM"];
579 }
580 }
581 }
582 else
583 {
584 foreach ($arSelectFields as $key => $val)
585 {
586 $val = mb_strtoupper($val);
587 $key = mb_strtoupper($key);
588 if (array_key_exists($val, $arFields))
589 {
590 if ($strSqlSelect <> '')
591 $strSqlSelect .= ", ";
592
593 if (in_array($key, $arGroupByFunct))
594 {
595 $strSqlSelect .= $key."(".$arFields[$val]["FIELD"].") as ".$val;
596 }
597 else
598 {
599 if ($arFields[$val]["TYPE"] == "datetime")
600 {
601 if (array_key_exists($val, $arOrder))
602 $strSqlSelect .= $arFields[$val]["FIELD"]." as ".$val."_X1, ";
603
604 $strSqlSelect .= $DB->DateToCharFunction($arFields[$val]["FIELD"], "FULL")." as ".$val;
605 }
606 elseif ($arFields[$val]["TYPE"] == "date")
607 {
608 if (array_key_exists($val, $arOrder))
609 $strSqlSelect .= $arFields[$val]["FIELD"]." as ".$val."_X1, ";
610
611 $strSqlSelect .= $DB->DateToCharFunction($arFields[$val]["FIELD"], "SHORT")." as ".$val;
612 }
613 else
614 $strSqlSelect .= $arFields[$val]["FIELD"]." as ".$val;
615 }
616
617 if (isset($arFields[$val]["FROM"])
618 && $arFields[$val]["FROM"] <> ''
619 && !in_array($arFields[$val]["FROM"], $arAlreadyJoined))
620 {
621 if ($strSqlFrom <> '')
622 $strSqlFrom .= " ";
623 $strSqlFrom .= $arFields[$val]["FROM"];
624 $arAlreadyJoined[] = $arFields[$val]["FROM"];
625 }
626 }
627 }
628 }
629
630 if ($strSqlGroupBy <> '')
631 {
632 if ($strSqlSelect <> '')
633 $strSqlSelect .= ", ";
634 $strSqlSelect .= "COUNT(%%_DISTINCT_%% ".$arFields[$arFieldsKeys[0]]["FIELD"].") as CNT";
635 }
636 else
637 $strSqlSelect = "%%_DISTINCT_%% ".$strSqlSelect;
638 }
639 // <-- SELECT
640
641 // WHERE -->
642 $arSqlSearch = Array();
643
644 if (!is_array($arFilter))
645 $filter_keys = Array();
646 else
647 $filter_keys = array_keys($arFilter);
648
649 foreach($filter_keys as $fkey)
650 {
651 $vals = $arFilter[$fkey];
652 if (!is_array($vals))
653 $vals = array($vals);
654
655 $key = $fkey;
657 $key = $key_res["FIELD"];
658 $strNegative = $key_res["NEGATIVE"];
659 $strOperation = $key_res["OPERATION"];
660 $strOrNull = $key_res["OR_NULL"];
661
662 $arSqlSearch_tmp = array();
663 if (array_key_exists($key, $arFields))
664 {
665 if (count($vals) > 0)
666 {
667 if ($strOperation == "IN")
668 {
669 if (isset($arFields[$key]["WHERE"]))
670 {
671 $arSqlSearch_tmp1 = call_user_func_array(
672 $arFields[$key]["WHERE"],
673 array($vals, $key, $strOperation, $strNegative, $arFields[$key]["FIELD"], $arFields, $arFilter)
674 );
675 if ($arSqlSearch_tmp1 !== false)
676 $arSqlSearch_tmp[] = $arSqlSearch_tmp1;
677 }
678 else
679 {
680 if ($arFields[$key]["TYPE"] == "int")
681 {
682 array_walk(
683 $vals,
684 function (&$item) {
685 $item = (int)$item;
686 }
687 );
688 $vals = array_unique($vals);
689 $val = implode(",", $vals);
690
691 if (count($vals) <= 0)
692 $arSqlSearch_tmp[] = "(1 = 2)";
693 else
694 $arSqlSearch_tmp[] = (($strNegative == "Y") ? " NOT " : "")."(".$arFields[$key]["FIELD"]." IN (".$val."))";
695 }
696 elseif ($arFields[$key]["TYPE"] == "double")
697 {
698 array_walk(
699 $vals,
700 function (&$item) {
701 $item = (float)$item;
702 }
703 );
704 $vals = array_unique($vals);
705 $val = implode(",", $vals);
706
707 if (count($vals) <= 0)
708 $arSqlSearch_tmp[] = "(1 = 2)";
709 else
710 $arSqlSearch_tmp[] = (($strNegative == "Y") ? " NOT " : "")."(".$arFields[$key]["FIELD"]." ".$strOperation." (".$val."))";
711 }
712 elseif ($arFields[$key]["TYPE"] == "string" || $arFields[$key]["TYPE"] == "char")
713 {
714 array_walk(
715 $vals,
716 function (&$item) {
717 $item = "'".$GLOBALS["DB"]->ForSql($item)."'";
718 }
719 );
720 $vals = array_unique($vals);
721 $val = implode(",", $vals);
722
723 if (count($vals) <= 0)
724 $arSqlSearch_tmp[] = "(1 = 2)";
725 else
726 $arSqlSearch_tmp[] = (($strNegative == "Y") ? " NOT " : "")."(".$arFields[$key]["FIELD"]." ".$strOperation." (".$val."))";
727 }
728 elseif ($arFields[$key]["TYPE"] == "datetime")
729 {
730 array_walk(
731 $vals,
732 function (&$item) {
733 $item = $GLOBALS["DB"]->CharToDateFunction($item, "FULL");
734 }
735 );
736 $vals = array_unique($vals);
737 $val = implode(",", $vals);
738
739 if (count($vals) <= 0)
740 $arSqlSearch_tmp[] = "1 = 2";
741 else
742 $arSqlSearch_tmp[] = ($strNegative=="Y"?" NOT ":"")."(".$arFields[$key]["FIELD"]." ".$strOperation." (".$val."))";
743 }
744 elseif ($arFields[$key]["TYPE"] == "date")
745 {
746 array_walk(
747 $vals,
748 function (&$item) {
749 $item = $GLOBALS["DB"]->CharToDateFunction($item, "SHORT");
750 }
751 );
752 $vals = array_unique($vals);
753 $val = implode(",", $vals);
754
755 if (count($vals) <= 0)
756 $arSqlSearch_tmp[] = "1 = 2";
757 else
758 $arSqlSearch_tmp[] = ($strNegative=="Y"?" NOT ":"")."(".$arFields[$key]["FIELD"]." ".$strOperation." (".$val."))";
759 }
760 }
761 }
762 else
763 {
764 foreach($vals as $val)
765 {
766 if (isset($arFields[$key]["WHERE"]))
767 {
768 $arSqlSearch_tmp1 = call_user_func_array(
769 $arFields[$key]["WHERE"],
770 array($val, $key, $strOperation, $strNegative, $arFields[$key]["FIELD"], $arFields, $arFilter)
771 );
772 if ($arSqlSearch_tmp1 !== false)
773 $arSqlSearch_tmp[] = $arSqlSearch_tmp1;
774 }
775 else
776 {
777 if ($arFields[$key]["TYPE"] == "int")
778 {
779 if ((intval($val) == 0) && (mb_strpos($strOperation, "=") !== False))
780 $arSqlSearch_tmp[] = "(".$arFields[$key]["FIELD"]." IS ".(($strNegative == "Y") ? "NOT " : "")."NULL) ".(($strNegative == "Y") ? "AND" : "OR")." ".(($strNegative == "Y") ? "NOT " : "")."(".$arFields[$key]["FIELD"]." ".$strOperation." 0)";
781 else
782 $arSqlSearch_tmp[] = (($strNegative == "Y") ? " ".$arFields[$key]["FIELD"]." IS NULL OR NOT " : "")."(".$arFields[$key]["FIELD"]." ".$strOperation." ".intval($val)." )";
783 }
784 elseif ($arFields[$key]["TYPE"] == "double")
785 {
786 $val = str_replace(",", ".", $val);
787
788 if ((DoubleVal($val) == 0) && (mb_strpos($strOperation, "=") !== False))
789 $arSqlSearch_tmp[] = "(".$arFields[$key]["FIELD"]." IS ".(($strNegative == "Y") ? "NOT " : "")."NULL) ".(($strNegative == "Y") ? "AND" : "OR")." ".(($strNegative == "Y") ? "NOT " : "")."(".$arFields[$key]["FIELD"]." ".$strOperation." 0)";
790 else
791 $arSqlSearch_tmp[] = (($strNegative == "Y") ? " ".$arFields[$key]["FIELD"]." IS NULL OR NOT " : "")."(".$arFields[$key]["FIELD"]." ".$strOperation." ".DoubleVal($val)." )";
792 }
793 elseif ($arFields[$key]["TYPE"] == "string" || $arFields[$key]["TYPE"] == "char")
794 {
795 if ($strOperation == "QUERY")
796 {
797 $arSqlSearch_tmp[] = GetFilterQuery($arFields[$key]["FIELD"], $val, "Y");
798 }
799 else
800 {
801 if (($val == '') && (mb_strpos($strOperation, "=") !== False))
802 $arSqlSearch_tmp[] = "(".$arFields[$key]["FIELD"]." IS ".(($strNegative == "Y") ? "NOT " : "")."NULL) ".(($strNegative == "Y") ? "AND NOT" : "OR")." (".$DB->Length($arFields[$key]["FIELD"])." <= 0) ".(($strNegative == "Y") ? "AND NOT" : "OR")." (".$arFields[$key]["FIELD"]." ".$strOperation." '".$DB->ForSql($val)."' )";
803 else
804 $arSqlSearch_tmp[] = (($strNegative == "Y") ? " ".$arFields[$key]["FIELD"]." IS NULL OR NOT " : "")."(".$arFields[$key]["FIELD"]." ".$strOperation." '".$DB->ForSql($val)."' )";
805 }
806 }
807 elseif ($arFields[$key]["TYPE"] == "datetime")
808 {
809 if ($val == '')
810 $arSqlSearch_tmp[] = ($strNegative=="Y"?"NOT":"")."(".$arFields[$key]["FIELD"]." IS NULL)";
811 else
812 $arSqlSearch_tmp[] = ($strNegative=="Y"?" ".$arFields[$key]["FIELD"]." IS NULL OR NOT ":"")."(".$arFields[$key]["FIELD"]." ".$strOperation." ".$DB->CharToDateFunction($DB->ForSql($val), "FULL").")";
813 }
814 elseif ($arFields[$key]["TYPE"] == "date")
815 {
816 if ($val == '')
817 $arSqlSearch_tmp[] = ($strNegative=="Y"?"NOT":"")."(".$arFields[$key]["FIELD"]." IS NULL)";
818 else
819 $arSqlSearch_tmp[] = ($strNegative=="Y"?" ".$arFields[$key]["FIELD"]." IS NULL OR NOT ":"")."(".$arFields[$key]["FIELD"]." ".$strOperation." ".$DB->CharToDateFunction($DB->ForSql($val), "SHORT").")";
820 }
821 }
822 }
823 }
824 }
825
826 if (isset($arFields[$key]["FROM"])
827 && $arFields[$key]["FROM"] <> ''
828 && !in_array($arFields[$key]["FROM"], $arAlreadyJoined))
829 {
830 if ($strSqlFrom <> '')
831 $strSqlFrom .= " ";
832 $strSqlFrom .= $arFields[$key]["FROM"];
833 $arAlreadyJoined[] = $arFields[$key]["FROM"];
834 }
835
836 $strSqlSearch_tmp = "";
837 foreach($arSqlSearch_tmp as $arSqlS)
838 {
839 if ($strSqlSearch_tmp <> '')
840 $strSqlSearch_tmp .= ($strNegative=="Y" ? " AND " : " OR ");
841 $strSqlSearch_tmp .= "(".$arSqlS.")";
842 }
843 if ($strOrNull == "Y")
844 {
845 if ($strSqlSearch_tmp <> '')
846 $strSqlSearch_tmp .= ($strNegative=="Y" ? " AND " : " OR ");
847 $strSqlSearch_tmp .= "(".$arFields[$key]["FIELD"]." IS ".($strNegative=="Y" ? "NOT " : "")."NULL)";
848
849 if ($strSqlSearch_tmp <> '')
850 $strSqlSearch_tmp .= ($strNegative=="Y" ? " AND " : " OR ");
851 if ($arFields[$key]["TYPE"] == "int" || $arFields[$key]["TYPE"] == "double")
852 $strSqlSearch_tmp .= "(".$arFields[$key]["FIELD"]." ".($strNegative=="Y" ? "<>" : "=")." 0)";
853 elseif ($arFields[$key]["TYPE"] == "string" || $arFields[$key]["TYPE"] == "char")
854 $strSqlSearch_tmp .= "(".$arFields[$key]["FIELD"]." ".($strNegative=="Y" ? "<>" : "=")." '')";
855 }
856
857 if ($strSqlSearch_tmp != "")
858 $arSqlSearch[] = "(".$strSqlSearch_tmp.")";
859 }
860 }
861
862 foreach($arSqlSearch as $sqlS)
863 {
864 if ($strSqlWhere <> '')
865 $strSqlWhere .= " AND ";
866 $strSqlWhere .= "(".$sqlS.")";
867 }
868 // <-- WHERE
869
870 // ORDER BY -->
871 $arSqlOrder = Array();
872 foreach ($arOrder as $by => $order)
873 {
874 $by = mb_strtoupper($by);
875 $order = mb_strtoupper($order);
876
877 if ($order != "ASC")
878 $order = "DESC";
879 else
880 $order = "ASC";
881
882 if (array_key_exists($by, $arFields))
883 {
884 $arSqlOrder[] = " ".(array_key_exists("ORDER", $arFields[$by])? $arFields[$by]["ORDER"]: $arFields[$by]["FIELD"])." ".$order." ";
885
886 if (isset($arFields[$by]["FROM"])
887 && $arFields[$by]["FROM"] <> ''
888 && !in_array($arFields[$by]["FROM"], $arAlreadyJoined))
889 {
890 if ($strSqlFrom <> '')
891 $strSqlFrom .= " ";
892 $strSqlFrom .= $arFields[$by]["FROM"];
893 $arAlreadyJoined[] = $arFields[$by]["FROM"];
894 }
895 }
896 elseif($obUserFieldsSql)
897 {
898 $arSqlOrder[] = " ".$obUserFieldsSql->GetOrder($by)." ".$order." ";
899 }
900 }
901
902 $strSqlOrderBy = "";
903 DelDuplicateSort($arSqlOrder);
904 foreach($arSqlOrder as $sqlO)
905 {
906 if ($strSqlOrderBy <> '')
907 $strSqlOrderBy .= ", ";
908
909 if($DB->type == "ORACLE")
910 {
911 if(mb_substr($sqlO, -3) == "ASC")
912 $strSqlOrderBy .= $sqlO." NULLS FIRST";
913 else
914 $strSqlOrderBy .= $sqlO." NULLS LAST";
915 }
916 else
917 $strSqlOrderBy .= $sqlO;
918 }
919 // <-- ORDER BY
920
921 return array(
922 "SELECT" => $strSqlSelect,
923 "FROM" => $strSqlFrom,
924 "WHERE" => $strSqlWhere,
925 "GROUPBY" => $strSqlGroupBy,
926 "ORDERBY" => $strSqlOrderBy
927 );
928 }
929
930 //*************** SELECT *********************/
931 public static function GetByID($ID)
932 {
933 global $DB;
934
935 $ID = intval($ID);
936
937 if($ID <= 0)
938 return false;
939
940 if (!isset($GLOBALS["BLOG"]["BLOG_CACHE_".$ID]) || !is_array($GLOBALS["BLOG"]["BLOG_CACHE_".$ID]) || !is_set($GLOBALS["BLOG"]["BLOG_CACHE_".$ID], "ID"))
941 {
942 $strSql =
943 "SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, ".
944 " B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, ".
945 " B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, ".
946 " B.EDITOR_USE_FONT, B.EDITOR_USE_LINK, B.EDITOR_USE_IMAGE, B.EDITOR_USE_FORMAT, B.EDITOR_USE_VIDEO, ".
947 " ".$DB->DateToCharFunction("B.DATE_CREATE", "FULL")." as DATE_CREATE, ".
948 " ".$DB->DateToCharFunction("B.DATE_UPDATE", "FULL")." as DATE_UPDATE, ".
949 " ".$DB->DateToCharFunction("B.LAST_POST_DATE", "FULL")." as LAST_POST_DATE ".
950 "FROM b_blog B ".
951 "WHERE B.ID = ".$ID."";
952
953 $dbResult = $DB->Query($strSql);
954 if ($arResult = $dbResult->Fetch())
955 {
956 $GLOBALS["BLOG"]["BLOG_CACHE_".$ID] = $arResult;
957 }
958 }
959
960 if(!empty($GLOBALS["BLOG"]["BLOG_CACHE_".$ID]))
961 {
962 return $GLOBALS["BLOG"]["BLOG_CACHE_".$ID];
963 }
964
965 return False;
966 }
967
968 public static function GetByOwnerID($ID, $arGroup = Array())
969 {
970 global $DB;
971
972 $ID = intval($ID);
973 if($ID <= 0)
974 return false;
975
976 $groups = "";
977 if(is_array($arGroup) && !empty($arGroup))
978 {
979 $i = 0;
980 foreach($arGroup as $v)
981 {
982 if(intval($v) > 0)
983 {
984 if($i != 0)
985 $groups .= ",";
986 $groups .= intval($v);
987 $i++;
988 }
989 }
990 }
991
992 if($groups == '')
993 $groups = "ALL";
994
995 if (!isset($GLOBALS["BLOG"]["BLOG4OWNER_CACHE_".$ID][$groups]) || !is_array($GLOBALS["BLOG"]["BLOG4OWNER_CACHE_".$ID][$groups]) || !is_set($GLOBALS["BLOG"]["BLOG4OWNER_CACHE_".$ID][$groups], "ID"))
996 {
997 $strSql =
998 "SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, ".
999 " B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, ".
1000 " B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, ".
1001 " B.EDITOR_USE_FONT, B.EDITOR_USE_LINK, B.EDITOR_USE_IMAGE, B.EDITOR_USE_FORMAT, B.EDITOR_USE_VIDEO, ".
1002 " ".$DB->DateToCharFunction("B.DATE_CREATE", "FULL")." as DATE_CREATE, ".
1003 " ".$DB->DateToCharFunction("B.DATE_UPDATE", "FULL")." as DATE_UPDATE, ".
1004 " ".$DB->DateToCharFunction("B.LAST_POST_DATE", "FULL")." as LAST_POST_DATE ".
1005 "FROM b_blog B ".
1006 "WHERE B.OWNER_ID = ".$ID." ";
1007 if($groups <> '' && $groups != "ALL")
1008 $strSql .= " AND B.GROUP_ID IN (".$groups.")";
1009
1010 $dbResult = $DB->Query($strSql);
1011 if ($arResult = $dbResult->Fetch())
1012 {
1013 $GLOBALS["BLOG"]["BLOG4OWNER_CACHE_".$ID][$groups] = $arResult;
1014 }
1015 }
1016
1017
1018 if(!empty($GLOBALS["BLOG"]["BLOG4OWNER_CACHE_".$ID][$groups]))
1019 {
1020 return $GLOBALS["BLOG"]["BLOG4OWNER_CACHE_".$ID][$groups];
1021 }
1022
1023 return False;
1024 }
1025
1026 public static function GetByUrl($BLOG_URL, $arGroup = Array())
1027 {
1028 global $DB;
1029
1030 $BLOG_URL = preg_replace("/[^a-zA-Z0-9_-]/is", "", Trim($BLOG_URL ?? ''));
1031 if($BLOG_URL == '')
1032 return false;
1033
1034 $groups = "";
1035 if(is_array($arGroup) && !empty($arGroup))
1036 {
1037 $i = 0;
1038 foreach($arGroup as $v)
1039 {
1040 if(intval($v) > 0)
1041 {
1042 if($i != 0)
1043 $groups .= ",";
1044 $groups .= intval($v);
1045 $i++;
1046 }
1047 }
1048 }
1049 if($groups == '')
1050 $groups = "ALL";
1051
1052 if (!isset($GLOBALS["BLOG"]["BLOGBYURL_CACHE_".$BLOG_URL][$groups]) || !is_array($GLOBALS["BLOG"]["BLOGBYURL_CACHE_".$BLOG_URL][$groups]) || !is_set($GLOBALS["BLOG"]["BLOGBYURL_CACHE_".$BLOG_URL][$groups], "ID"))
1053 {
1054 $strSql =
1055 "SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, ".
1056 " B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, ".
1057 " B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, ".
1058 " B.EDITOR_USE_FONT, B.EDITOR_USE_LINK, B.EDITOR_USE_IMAGE, B.EDITOR_USE_FORMAT, B.EDITOR_USE_VIDEO, ".
1059 " ".$DB->DateToCharFunction("B.DATE_CREATE", "FULL")." as DATE_CREATE, ".
1060 " ".$DB->DateToCharFunction("B.DATE_UPDATE", "FULL")." as DATE_UPDATE, ".
1061 " ".$DB->DateToCharFunction("B.LAST_POST_DATE", "FULL")." as LAST_POST_DATE ".
1062 "FROM b_blog B ".
1063 "WHERE B.URL = '".$DB->ForSql($BLOG_URL)."' ";
1064 if($groups <> '' && $groups != "ALL")
1065 $strSql .= " AND B.GROUP_ID IN (".$groups.")";
1066
1067 $dbResult = $DB->Query($strSql);
1068 if ($arResult = $dbResult->Fetch())
1069 {
1070 $GLOBALS["BLOG"]["BLOGBYURL_CACHE_".$BLOG_URL][$groups] = $arResult;
1071 }
1072 }
1073
1074 if(!empty($GLOBALS["BLOG"]["BLOGBYURL_CACHE_".$BLOG_URL][$groups]))
1075 {
1076 return $GLOBALS["BLOG"]["BLOGBYURL_CACHE_".$BLOG_URL][$groups];
1077 }
1078
1079 return False;
1080 }
1081
1082 public static function GetBySocNetGroupID($ID, $arGroup = Array())
1083 {
1084 global $DB;
1085
1086 $ID = intval($ID);
1087 if($ID <= 0)
1088 return false;
1089
1090 $groups = "";
1091 if(is_array($arGroup) && !empty($arGroup))
1092 {
1093 $i = 0;
1094 foreach($arGroup as $v)
1095 {
1096 if(intval($v) > 0)
1097 {
1098 if($i != 0)
1099 $groups .= ",";
1100 $groups .= intval($v);
1101 $i++;
1102 }
1103 }
1104 }
1105 if($groups == '')
1106 $groups = "ALL";
1107
1108 if (!isset($GLOBALS["BLOG"]["BLOG4OWNERGROUP_CACHE_".$ID][$groups]) || !is_array($GLOBALS["BLOG"]["BLOG4OWNERGROUP_CACHE_".$ID][$groups]) || !is_set($GLOBALS["BLOG"]["BLOG4OWNERGROUP_CACHE_".$ID][$groups], "ID"))
1109 {
1110 $strSql =
1111 "SELECT B.ID, B.NAME, B.DESCRIPTION, B.ACTIVE, B.OWNER_ID, B.URL, B.GROUP_ID, ".
1112 " B.ENABLE_COMMENTS, B.ENABLE_IMG_VERIF, B.EMAIL_NOTIFY, B.ENABLE_RSS, B.REAL_URL, ".
1113 " B.LAST_POST_ID, B.AUTO_GROUPS, B.ALLOW_HTML, B.SEARCH_INDEX, B.SOCNET_GROUP_ID, B.USE_SOCNET, ".
1114 " ".$DB->DateToCharFunction("B.DATE_CREATE", "FULL")." as DATE_CREATE, ".
1115 " ".$DB->DateToCharFunction("B.DATE_UPDATE", "FULL")." as DATE_UPDATE, ".
1116 " ".$DB->DateToCharFunction("B.LAST_POST_DATE", "FULL")." as LAST_POST_DATE ".
1117 "FROM b_blog B ".
1118 "WHERE B.SOCNET_GROUP_ID = ".$ID." ";
1119 if($groups <> '' && $groups != "ALL")
1120 $strSql .= " AND B.GROUP_ID IN (".$groups.")";
1121
1122 $dbResult = $DB->Query($strSql);
1123 if ($arResult = $dbResult->Fetch())
1124 {
1125 $GLOBALS["BLOG"]["BLOG4OWNERGROUP_CACHE_".$ID][$groups] = $arResult;
1126 }
1127 }
1128
1129 if(!empty($GLOBALS["BLOG"]["BLOG4OWNERGROUP_CACHE_".$ID][$groups]))
1130 {
1131 return $GLOBALS["BLOG"]["BLOG4OWNERGROUP_CACHE_".$ID][$groups];
1132 }
1133
1134 return False;
1135 }
1136
1137 public static function BuildRSS($ID, $type = "RSS .92", $numPosts = 10, $blogTemplate="", $postTemplate="", $userTemplate="", $bSoNet = false, $arParams = Array())
1138 {
1139 global $USER;
1140
1141 $ID = intval($ID);
1142 if($ID <= 0 && $arParams["USE_SOCNET"] != "Y")
1143 return false;
1144 $numPosts = intval($numPosts);
1145 $type = mb_strtolower(preg_replace("/[^a-zA-Z0-9.]/is", "", $type));
1146 if ($type != "rss2.0" && $type != "atom.03")
1147 $type = "rss.92";
1148
1149 $rssText = False;
1150
1151 $arBlog = CBlog::GetByID($ID);
1152 if (($arBlog && $arBlog["ACTIVE"] == "Y" && $arBlog["ENABLE_RSS"] == "Y") || $arParams["USE_SOCNET"] == "Y")
1153 {
1154 $arGroup = $arBlog? CBlogGroup::GetByID($arBlog["GROUP_ID"]): false;
1155 if($arGroup && $arGroup["SITE_ID"] == SITE_ID || $arParams["USE_SOCNET"] == "Y")
1156 {
1157 $now = date("r");
1158 $nowISO = date("Y-m-d\\TH:i:s").mb_substr(date("O"), 0, 3).":".mb_substr(date("O"), -2, 2);
1159
1160 $serverName = "";
1161 $charset = "";
1162 $language = "";
1163 $dbSite = CSite::GetList("sort", "asc", array("LID" => SITE_ID));
1164 if ($arSite = $dbSite->Fetch())
1165 {
1166 $serverName = $arSite["SERVER_NAME"];
1167 $charset = $arSite["CHARSET"];
1168 $language = $arSite["LANGUAGE_ID"];
1169 }
1170
1171 if ($serverName == '')
1172 {
1173 if (defined("SITE_SERVER_NAME") && SITE_SERVER_NAME <> '')
1174 $serverName = SITE_SERVER_NAME;
1175 else
1176 $serverName = COption::GetOptionString("main", "server_name", "");
1177 }
1178 $serverName = HtmlFilter::encode($serverName);
1179
1180 if ($charset == '')
1181 {
1182 if (defined("SITE_CHARSET") && SITE_CHARSET <> '')
1183 $charset = SITE_CHARSET;
1184 else
1185 $charset = "windows-1251";
1186 }
1187
1188 $user_id = intval($USER->GetID());
1189 if($bSoNet)
1190 {
1191 $postPerm = BLOG_PERMS_DENY;
1192 if(intval($arParams["SOCNET_GROUP_ID"]) > 0)
1193 {
1194 if (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "blog", "view_post"))
1195 $postPerm = BLOG_PERMS_READ;
1196 if (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "blog", "write_post"))
1197 $postPerm = BLOG_PERMS_WRITE;
1198 if (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "blog", "full_post", CSocNetUser::IsCurrentUserModuleAdmin()) || $GLOBALS["APPLICATION"]->GetGroupRight("blog") >= "W")
1199 $postPerm = BLOG_PERMS_FULL;
1200 }
1201 else
1202 {
1203 if($user_id == $arParams["USER_ID"])
1204 $postPerm = BLOG_PERMS_FULL;
1205 elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_USER, $arParams["USER_ID"], "blog", "view_post"))
1206 $postPerm = BLOG_PERMS_READ;
1207 }
1208 }
1209 else
1210 {
1211 $postPerm = CBlog::GetBlogUserPostPerms($ID, intval($user_id));
1212 }
1213
1214 $blogName = '';
1215 $blogURL = '';
1216 $blogDescr = '';
1217 if($postPerm >= BLOG_PERMS_READ)
1218 {
1219 if ($bSoNet)
1220 {
1221 if (intval($arParams["USER_ID"]) > 0)
1222 {
1223 $dbUser = CUser::GetByID($arParams["USER_ID"]);
1224 if ($arUser = $dbUser->Fetch())
1225 {
1226 $blogName = htmlspecialcharsbx(GetMessage("BLG_RSS_NAME_SONET", Array("#AUTHOR_NAME#" => CUser::FormatName(CSite::GetNameFormat(false), $arUser, true))));
1227 $blogURL = "http://".$serverName.htmlspecialcharsbx(CComponentEngine::MakePathFromTemplate($blogTemplate, array("user_id" => $arParams["USER_ID"])));
1228 }
1229 }
1230 else
1231 {
1232 if ($arGroupSoNet = CSocNetGroup::GetByID($arParams["SOCNET_GROUP_ID"]))
1233 {
1234 $blogName = htmlspecialcharsbx(GetMessage("BLG_RSS_NAME_SONET_GROUP", Array("#GROUP_NAME#" => $arGroupSoNet["NAME"])));
1235 $blogURL = "http://".$serverName.htmlspecialcharsbx(CComponentEngine::MakePathFromTemplate($blogTemplate, array("group_id" => $arParams["SOCNET_GROUP_ID"])));
1236 }
1237 }
1238 $blogDescr = "";
1239 }
1240 else
1241 {
1242 if ($blogTemplate <> '')
1243 $blogURL = "http://".$serverName.htmlspecialcharsbx(CComponentEngine::MakePathFromTemplate($blogTemplate, array("blog" => $arBlog["URL"], "user_id" => $arBlog["OWNER_ID"], "group_id" => $arBlog["SOCNET_GROUP_ID"])));
1244 else
1245 $blogURL = "http://".$serverName.htmlspecialcharsbx(CBlog::PreparePath($arBlog["URL"], $arGroup["SITE_ID"]));
1246 $blogName = htmlspecialcharsbx($arBlog["NAME"]);
1247 $blogDescr = htmlspecialcharsbx($arBlog["DESCRIPTION"]);
1248 }
1249 }
1250
1251 $rssText = "";
1252 if ($type == "rss.92")
1253 {
1254 $rssText .= "<"."?xml version=\"1.0\" encoding=\"".$charset."\"?".">\n\n";
1255 $rssText .= "<rss version=\".92\">\n";
1256 $rssText .= " <channel>\n";
1257 $rssText .= " <title>".$blogName."</title>\n";
1258 $rssText .= " <link>".$blogURL."</link>\n";
1259 $rssText .= " <description>".$blogDescr."</description>\n";
1260 $rssText .= " <language>".$language."</language>\n";
1261 $rssText .= " <docs>http://backend.userland.com/rss092</docs>\n";
1262 $rssText .= "\n";
1263 }
1264 elseif ($type == "rss2.0")
1265 {
1266 $rssText .= "<"."?xml version=\"1.0\" encoding=\"".$charset."\"?".">\n\n";
1267 $rssText .= "<rss version=\"2.0\">\n";
1268 $rssText .= " <channel>\n";
1269 $rssText .= " <title>".$blogName."</title>\n";
1270 //$rssText .= " <guid>".$blogURL."</guid>\n";
1271 $rssText .= " <link>".$blogURL."</link>\n";
1272 $rssText .= " <description>".$blogDescr."</description>\n";
1273 $rssText .= " <language>".$language."</language>\n";
1274 $rssText .= " <docs>http://backend.userland.com/rss2</docs>\n";
1275 $rssText .= " <pubDate>".$now."</pubDate>\n";
1276 $rssText .= "\n";
1277 }
1278 elseif ($type == "atom.03")
1279 {
1280 $atomID = "tag:".$serverName.",".date("Y-m-d").":".$ID;
1281
1282 $rssText .= "<"."?xml version=\"1.0\" encoding=\"".$charset."\"?".">\n\n";
1283 $rssText .= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\" xml:lang=\"".$language."\">\n";
1284 $rssText .= " <title>".$blogName."</title>\n";
1285 $rssText .= " <tagline>".$blogURL."</tagline>\n";
1286 //$rssText .= " <link href=\"".$blogURL."\"/>";
1287 $rssText .= " <id>".$atomID."</id>\n";
1288 $rssText .= " <link rel=\"alternate\" type=\"text/html\" href=\"".$blogURL."\" />\n";
1289 $rssText .= " <copyright>Copyright (c) ".$blogURL."</copyright>\n";
1290 $rssText .= " <modified>".$nowISO."</modified>\n";
1291 $rssText .= "\n";
1292 }
1293
1294 if($postPerm >= BLOG_PERMS_READ)
1295 {
1296 $parser = new blogTextParser();
1297 $arParserParams = Array(
1298 "imageWidth" => $arParams["IMAGE_MAX_WIDTH"],
1299 "imageHeight" => $arParams["IMAGE_MAX_HEIGHT"],
1300 );
1301 if($bSoNet)
1302 {
1303 $arFilter = array(
1304 "<=DATE_PUBLISH" => ConvertTimeStamp(false, "FULL", false),
1305 "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH,
1306 "BLOG_ACTIVE" => "Y",
1307 "BLOG_GROUP_SITE_ID" => SITE_ID,
1308 );
1309 if(intval($arParams["SOCNET_GROUP_ID"]) > 0)
1310 $arFilter["SOCNET_GROUP_ID"] = $arParams["SOCNET_GROUP_ID"];
1311 else
1312 {
1313 $arFilter["FOR_USER"] = $user_id;
1314 $arFilter["AUTHOR_ID"] = $arParams["USER_ID"];
1315 }
1316 }
1317 else
1318 {
1319 $arFilter = array(
1320 "BLOG_ID" => $ID,
1321 "<=DATE_PUBLISH" => ConvertTimeStamp(false, "FULL", false),
1322 "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH,
1323 "MICRO" => "N",
1324 );
1325
1326 }
1327 CTimeZone::Disable();
1328 $dbPosts = CBlogPost::GetList(
1329 array("DATE_PUBLISH" => "DESC"),
1330 $arFilter,
1331 false,
1332 array("nTopCount" => $numPosts),
1333 array("ID", "TITLE", "DETAIL_TEXT", "DATE_PUBLISH", "AUTHOR_ID", "AUTHOR_NAME", "AUTHOR_LAST_NAME", "BLOG_USER_ALIAS", "DETAIL_TEXT_TYPE", "CODE", "PATH")
1334 );
1335 CTimeZone::Enable();
1336
1337 while ($arPost = $dbPosts->Fetch())
1338 {
1339 if(!$bSoNet)
1340 {
1341 $perms = CBlogPost::GetBlogUserPostPerms($arPost["ID"], ($GLOBALS["USER"]->IsAuthorized() ? $GLOBALS["USER"]->GetID() : 0));
1342 if ($perms < BLOG_PERMS_READ)
1343 continue;
1344 }
1345
1346 //$title = htmlspecialcharsEx($arPost["TITLE"]);
1347 $title = str_replace(
1348 array("&", "<", ">", "\""),
1349 array("&amp;", "&lt;", "&gt;", "&quot;"),
1350 $arPost["TITLE"]);
1351
1352 $arImages = Array();
1353 $res = CBlogImage::GetList(array("ID"=>"ASC"),array("POST_ID"=>$arPost['ID'], "BLOG_ID"=>$ID, "IS_COMMENT" => "N"));
1354 while ($arImage = $res->Fetch())
1355 $arImages[$arImage['ID']] = $arImage['FILE_ID'];
1356
1357 $arDate = ParseDateTime($arPost["DATE_PUBLISH"], CSite::GetDateFormat("FULL", $arGroup["SITE_ID"]));
1358 $date = date("r", mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));
1359
1360 if($arPost["PATH"] <> '')
1361 $url = "http://".$serverName.htmlspecialcharsbx(str_replace("#post_id#", CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), $arPost["PATH"]));
1362 elseif($postTemplate <> '')
1363 $url = "http://".$serverName.htmlspecialcharsbx(CComponentEngine::MakePathFromTemplate($postTemplate, array("blog" => $arBlog["URL"], "post_id"=>CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), "user_id" => (intval($arParams["USER_ID"]) > 0 ? $arParams["USER_ID"] : $arBlog["OWNER_ID"]), "group_id" => (intval($arParams["SOCNET_GROUP_ID"]) > 0 ? $arParams["SOCNET_GROUP_ID"] : $arBlog["SOCNET_GROUP_ID"]))));
1364 else
1365 $url = "http://".$serverName.htmlspecialcharsbx(CBlogPost::PreparePath($arBlog["URL"], $arPost["ID"], $arGroup["SITE_ID"]));
1366
1367 $category = htmlspecialcharsbx($arPost["CATEGORY_NAME"]);
1368
1369 $BlogUser = CBlogUser::GetByID($arPost["AUTHOR_ID"], BLOG_BY_USER_ID);
1370 $dbUser = CUser::GetByID($arPost["AUTHOR_ID"]);
1371 $arUser = $dbUser->Fetch();
1372 $author = htmlspecialcharsex(CBlogUser::GetUserName($BlogUser["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"], $arUser["SECOND_NAME"]));
1373
1374 if($userTemplate <> '')
1375 $authorURL = "http://".$serverName.htmlspecialcharsbx(CComponentEngine::MakePathFromTemplate($userTemplate, array("user_id"=>$arPost["AUTHOR_ID"])));
1376 else
1377 $authorURL = "http://".$serverName.htmlspecialcharsbx(CBlogUser::PreparePath($arPost["AUTHOR_ID"], $arGroup["SITE_ID"]));
1378
1379 if($arPost["DETAIL_TEXT_TYPE"] == "html")
1380 $text = $parser->convert_to_rss($arPost["DETAIL_TEXT"], $arImages, array("HTML" => "Y", "ANCHOR" => "Y", "IMG" => "Y", "SMILES" => "Y", "NL2BR" => "N", "QUOTE" => "Y", "CODE" => "Y"), true, $arParserParams);
1381 else
1382 $text = $parser->convert_to_rss($arPost["DETAIL_TEXT"], $arImages, false, !$bSoNet, $arParserParams);
1383
1384 if(!$bSoNet)
1385 $text .= "<br /><a href=\"".$url."\">".GetMessage("BLG_GB_RSS_DETAIL")."</a>";
1386
1387 $text = "<![CDATA[".$text."]]>";
1388
1389
1390 if ($type == "rss.92")
1391 {
1392 $rssText .= " <item>\n";
1393 $rssText .= " <title>".$title."</title>\n";
1394 $rssText .= " <description>".$text."</description>\n";
1395 $rssText .= " <link>".$url."</link>\n";
1396 $rssText .= " </item>\n";
1397 $rssText .= "\n";
1398 }
1399 elseif ($type == "rss2.0")
1400 {
1401 $rssText .= " <item>\n";
1402 $rssText .= " <title>".$title."</title>\n";
1403 $rssText .= " <description>".$text."</description>\n";
1404 $rssText .= " <link>".$url."</link>\n";
1405 $rssText .= " <guid>".$url."</guid>\n";
1406 $rssText .= " <pubDate>".$date."</pubDate>\n";
1407 if($category <> '')
1408 $rssText .= " <category>".$category."</category>\n";
1409 $rssText .= " </item>\n";
1410 $rssText .= "\n";
1411 }
1412 elseif ($type == "atom.03")
1413 {
1414 $atomID = "tag:".$serverName.":".$arBlog["URL"]."/".$arPost["ID"];
1415
1416 $timeISO = mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]);
1417 $dateISO = date("Y-m-d\\TH:i:s", $timeISO).mb_substr(date("O", $timeISO), 0, 3).":".mb_substr(date("O", $timeISO), -2, 2);
1418
1419 $titleRel = htmlspecialcharsbx($arPost["TITLE"]);
1420
1421 $rssText .= "<entry>\n";
1422 $rssText .= " <title type=\"text/html\">".$title."</title>\n";
1423 $rssText .= " <link rel=\"alternate\" type=\"text/html\" href=\"".$url."\"/>\n";
1424 $rssText .= " <issued>".$dateISO."</issued>\n";
1425 $rssText .= " <modified>".$nowISO."</modified>\n";
1426 $rssText .= " <id>".$atomID."</id>\n";
1427 $rssText .= " <content type=\"text/html\" mode=\"escaped\" xml:lang=\"".$language."\" xml:base=\"".$blogURL."\">\n";
1428 $rssText .= $text."\n";
1429 $rssText .= " </content>\n";
1430 $rssText .= " <link rel=\"related\" type=\"text/html\" href=\"".$url."\" title=\"".$titleRel."\"/>\n";
1431 $rssText .= " <author>\n";
1432 $rssText .= " <name>".$author."</name>\n";
1433 $rssText .= " <url>".$authorURL."</url>\n";
1434 $rssText .= " </author>\n";
1435 $rssText .= "</entry>\n";
1436 $rssText .= "\n";
1437 }
1438 }
1439 }
1440
1441 if ($type == "rss.92")
1442 $rssText .= " </channel>\n</rss>";
1443 elseif ($type == "rss2.0")
1444 $rssText .= " </channel>\n</rss>";
1445 elseif ($type == "atom.03")
1446 $rssText .= "\n\n</feed>";
1447 }
1448 }
1449
1450 return $rssText;
1451 }
1452
1453 public static function PreparePath($blogUrl, $siteID = False, $is404 = True, $userID = 0, $groupID = 0)
1454 {
1455 $blogUrl = Trim($blogUrl);
1456 if (!$siteID)
1457 $siteID = SITE_ID;
1458
1459 $dbPath = CBlogSitePath::GetList(array(), array("SITE_ID"=>$siteID));
1460 while($arPath = $dbPath->Fetch())
1461 {
1462 if($arPath["TYPE"] <> '')
1463 $arPaths[$arPath["TYPE"]] = $arPath["PATH"];
1464 else
1465 $arPaths["OLD"] = $arPath["PATH"];
1466 }
1467 if($groupID > 0 && $arPaths["G"] <> '')
1468 {
1469 $result = str_replace("#blog#", $blogUrl, $arPaths["G"]);
1470 $result = str_replace("#user_id#", $userID, $result);
1471 $result = str_replace("#group_id#", $groupID, $result);
1472 }
1473 elseif($arPaths["B"] <> '')
1474 {
1475 $result = str_replace("#blog#", $blogUrl, $arPaths["B"]);
1476 $result = str_replace("#user_id#", $userID, $result);
1477 $result = str_replace("#group_id#", $groupID, $result);
1478 }
1479 else
1480 {
1481 if($is404)
1482 $result = htmlspecialcharsbx($arPaths["OLD"])."/".htmlspecialcharsbx($blogUrl)."/";
1483 else
1484 $result = htmlspecialcharsbx($arPaths["OLD"])."/blog.php?blog=".$blogUrl;
1485 }
1486
1487 return $result;
1488 }
1489
1490 public static function IsFriend($ID, $userID)
1491 {
1492 global $DB;
1493
1494 $ID = intval($ID);
1495 $userID = intval($userID);
1496
1497 if ($ID <= 0 || $userID <= 0)
1498 return False;
1499
1500 $cnt = CBlogUser::GetList(
1501 array(),
1502 array("USER_ID" => $userID, "GROUP_BLOG_ID" => $ID),
1503 array()
1504 );
1505
1506 return ($cnt > 0);
1507 }
1508
1509 public static function BuildRSSAll($GroupId = 0, $type = "RSS .92", $numPosts = 10, $siteID = SITE_ID, $postTemplate="", $userTemplate="", $arAvBlog = Array(), $arPathTemplates = Array(), $arGroupID = Array(), $bUserSocNet = "N")
1510 {
1511 global $USER;
1512
1513 $GroupId = intval($GroupId);
1514 $numPosts = intval($numPosts);
1515 $user_id = intval($USER->GetID());
1516 $type = mb_strtolower(preg_replace("/[^a-zA-Z0-9.]/is", "", $type));
1517 if ($type != "rss2.0" && $type != "atom.03")
1518 $type = "rss.92";
1519
1520 $rssText = False;
1521 $groupIdArray = array();
1522 $arGroup = Array();
1523
1524 if($GroupId > 0)
1525 {
1526 if((!empty($arGroupID) && in_array($GroupId, $arGroupID)) || empty($arGroupID))
1527 {
1528 $arGroup = CBlogGroup::GetByID($GroupId);
1529 }
1530 }
1531
1532 $now = date("r");
1533 $nowISO = date("Y-m-d\\TH:i:s").mb_substr(date("O"), 0, 3).":".mb_substr(date("O"), -2, 2);
1534
1535 $serverName = "";
1536 $charset = "";
1537 $language = "";
1538 $dbSite = CSite::GetList("sort", "asc", array("LID" => SITE_ID));
1539 if ($arSite = $dbSite->Fetch())
1540 {
1541 $serverName = $arSite["SERVER_NAME"];
1542 $charset = $arSite["CHARSET"];
1543 $language = $arSite["LANGUAGE_ID"];
1544 }
1545
1546 if ($serverName == '')
1547 {
1548 if (defined("SITE_SERVER_NAME") && SITE_SERVER_NAME <> '')
1549 $serverName = SITE_SERVER_NAME;
1550 else
1551 $serverName = COption::GetOptionString("main", "server_name", "");
1552 }
1553 $serverName = HtmlFilter::encode($serverName);
1554
1555 if ($charset == '')
1556 {
1557 if (defined("SITE_CHARSET") && SITE_CHARSET <> '')
1558 $charset = SITE_CHARSET;
1559 else
1560 $charset = "windows-1251";
1561 }
1562
1563 $blogURL = "http://".$serverName;
1564 if($GroupId > 0)
1565 $blogName = GetMessage("BLG_RSS_ALL_GROUP_TITLE")." \"".htmlspecialcharsbx($arGroup["NAME"])."\" (".$serverName.")";
1566 else
1567 $blogName = GetMessage("BLG_RSS_ALL_TITLE")." \"".htmlspecialcharsbx($arSite["NAME"])."\" (".$serverName.")";
1568
1569 $rssText = "";
1570 if ($type == "rss.92")
1571 {
1572 $rssText .= "<"."?xml version=\"1.0\" encoding=\"".$charset."\"?".">\n\n";
1573 $rssText .= "<rss version=\".92\">\n";
1574 $rssText .= " <channel>\n";
1575 $rssText .= " <title>".$blogName."</title>\n";
1576 $rssText .= " <link>".$blogURL."</link>\n";
1577 $rssText .= " <guid>".$blogURL."</guid>\n";
1578 $rssText .= " <language>".$language."</language>\n";
1579 $rssText .= " <docs>http://backend.userland.com/rss092</docs>\n";
1580 $rssText .= "\n";
1581 }
1582 elseif ($type == "rss2.0")
1583 {
1584 $rssText .= "<"."?xml version=\"1.0\" encoding=\"".$charset."\"?".">\n\n";
1585 $rssText .= "<rss version=\"2.0\">\n";
1586 $rssText .= " <channel>\n";
1587 $rssText .= " <title>".$blogName."</title>\n";
1588 $rssText .= " <description>".$blogName."</description>\n";
1589 $rssText .= " <link>".$blogURL."</link>\n";
1590 $rssText .= " <language>".$language."</language>\n";
1591 $rssText .= " <docs>http://backend.userland.com/rss2</docs>\n";
1592 $rssText .= " <pubDate>".$now."</pubDate>\n";
1593 $rssText .= "\n";
1594 }
1595 elseif ($type == "atom.03")
1596 {
1597 $atomID = "tag:".$serverName.",".date("Y-m-d");
1598
1599 $rssText .= "<"."?xml version=\"1.0\" encoding=\"".$charset."\"?".">\n\n";
1600 $rssText .= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\" xml:lang=\"".$language."\">\n";
1601 $rssText .= " <title>".$blogName."</title>\n";
1602 $rssText .= " <tagline>".$blogURL."</tagline>\n";
1603 $rssText .= " <id>".$atomID."</id>\n";
1604 $rssText .= " <link rel=\"alternate\" type=\"text/html\" href=\"".$blogURL."\" />\n";
1605 $rssText .= " <copyright>Copyright (c) ".$blogURL."</copyright>\n";
1606 $rssText .= " <modified>".$nowISO."</modified>\n";
1607 $rssText .= "\n";
1608 }
1609
1610 $parser = new blogTextParser();
1611 $arParserParams = Array(
1612 "imageWidth" => $arPathTemplates["IMAGE_MAX_WIDTH"],
1613 "imageHeight" => $arPathTemplates["IMAGE_MAX_HEIGHT"],
1614 );
1615
1616 $arFilter = array(
1617 "<=DATE_PUBLISH" => ConvertTimeStamp(false, "FULL", false),
1618 "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH,
1619 "BLOG_ENABLE_RSS" => "Y",
1620 "MICRO" => "N",
1621 );
1622
1623 $arSelFields = array("ID", "TITLE", "DETAIL_TEXT", "DATE_PUBLISH", "AUTHOR_ID", "BLOG_USER_ALIAS", "BLOG_ID", "DETAIL_TEXT_TYPE", "BLOG_URL", "BLOG_OWNER_ID", "BLOG_SOCNET_GROUP_ID", "BLOG_GROUP_SITE_ID", "CODE", "PATH");
1624
1625 if(!empty($arGroup))
1626 $arFilter["BLOG_GROUP_ID"] = $arGroup["ID"];
1627 elseif(count($arGroupID) > 0)
1628 $arFilter["BLOG_GROUP_ID"] = $arGroupID;
1629 if(count($arAvBlog) > 0)
1630 $arFilter["BLOG_ID"] = $arAvBlog;
1631 if($siteID !== false)
1632 $arFilter["BLOG_GROUP_SITE_ID"] = $siteID;
1633 if($bUserSocNet == "Y")
1634 {
1635 $arFilter["BLOG_USE_SOCNET"] = "Y";
1636 $arFilter["FOR_USER"] = $user_id;
1637 unset($arFilter["MICRO"]);
1638 }
1639
1640 CTimeZone::Disable();
1641 $dbPosts = CBlogPost::GetList(
1642 array("DATE_PUBLISH" => "DESC"),
1643 $arFilter,
1644 false,
1645 array("nTopCount" => $numPosts),
1646 $arSelFields
1647 );
1648 CTimeZone::Enable();
1649
1650 while ($arPost = $dbPosts->Fetch())
1651 {
1652 $perms = CBlogPost::GetBlogUserPostPerms($arPost["ID"], ($GLOBALS["USER"]->IsAuthorized() ? $GLOBALS["USER"]->GetID() : 0));
1653 if ($perms < BLOG_PERMS_READ)
1654 continue;
1655
1656 $dbUser = CUser::GetByID($arPost["AUTHOR_ID"]);
1657 $arUser = $dbUser->Fetch();
1658 $author = CBlogUser::GetUserName($arPost["BLOG_USER_ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"], $arUser["SECOND_NAME"]);
1659
1660 $title = str_replace(
1661 array("&", "<", ">", "\""),
1662 array("&amp;", "&lt;", "&gt;", "&quot;"),
1663 $author.": ".$arPost["TITLE"]);
1664
1665
1666 $arImages = Array();
1667 $res = CBlogImage::GetList(array("ID"=>"ASC"),array("POST_ID"=>$arPost["ID"], "BLOG_ID"=>$arPost["BLOG_ID"], "IS_COMMENT" => "N"));
1668 while ($arImage = $res->Fetch())
1669 $arImages[$arImage['ID']] = $arImage['FILE_ID'];
1670
1671 $arDate = ParseDateTime($arPost["DATE_PUBLISH"], CSite::GetDateFormat("FULL", $arPost["BLOG_GROUP_SITE_ID"]));
1672 $date = date("r", mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));
1673
1674 if($arPost["PATH"] <> '')
1675 {
1676 $url = "http://".$serverName.htmlspecialcharsbx(str_replace("#post_id#", CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arPathTemplates["ALLOW_POST_CODE"]), $arPost["PATH"]));
1677 }
1678 elseif(!empty($arPathTemplates))
1679 {
1680 if(intval($arPost["BLOG_SOCNET_GROUP_ID"]) > 0 && $arPathTemplates["GROUP_BLOG_POST"] <> '')
1681 $url = "http://".$serverName.htmlspecialcharsbx(CComponentEngine::MakePathFromTemplate($arPathTemplates["GROUP_BLOG_POST"], array("blog" => $arPost["BLOG_URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arPathTemplates["ALLOW_POST_CODE"]), "user_id"=>$arPost["BLOG_OWNER_ID"], "group_id"=>$arPost["BLOG_SOCNET_GROUP_ID"])));
1682 else
1683 $url = "http://".$serverName.htmlspecialcharsbx(CComponentEngine::MakePathFromTemplate($arPathTemplates["BLOG_POST"], array("blog" => $arPost["BLOG_URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arPathTemplates["ALLOW_POST_CODE"]), "user_id"=>$arPost["BLOG_OWNER_ID"], "group_id"=>$arPost["BLOG_SOCNET_GROUP_ID"])));
1684 }
1685 elseif($postTemplate <> '')
1686 {
1687 $url = "http://".$serverName.htmlspecialcharsbx(CComponentEngine::MakePathFromTemplate($postTemplate, array("blog" => $arPost["BLOG_URL"], "post_id"=>$arPost["ID"], "user_id"=>$arPost["BLOG_OWNER_ID"], "group_id"=>$arPost["BLOG_SOCNET_GROUP_ID"])));
1688 }
1689 else
1690 {
1691 $url = "http://".$serverName.htmlspecialcharsbx(CBlogPost::PreparePath(htmlspecialcharsbx($arPost["BLOG_URL"]), $arPost["ID"], $arPost["BLOG_GROUP_SITE_ID"]));
1692 }
1693
1694 $category = htmlspecialcharsbx($arPost["CATEGORY_NAME"]);
1695 if($arPathTemplates["USER"] <> '')
1696 {
1697 $authorURL = "http://".$serverName.htmlspecialcharsbx(CComponentEngine::MakePathFromTemplate($arPathTemplates["USER"], array("user_id"=>$arPost["AUTHOR_ID"], "group_id"=>$arPost["BLOG_SOCNET_GROUP_ID"])));
1698 }
1699 elseif($userTemplate <> '')
1700 $authorURL = "http://".$serverName.htmlspecialcharsbx(CComponentEngine::MakePathFromTemplate($userTemplate, array("user_id"=>$arPost["AUTHOR_ID"], "group_id"=>$arPost["BLOG_SOCNET_GROUP_ID"])));
1701 else
1702 $authorURL = "http://".$serverName.htmlspecialcharsbx(CBlogUser::PreparePath($arPost["AUTHOR_ID"], $arPost["BLOG_GROUP_SITE_ID"]));
1703
1704 if($arPost["DETAIL_TEXT_TYPE"] == "html")
1705 $text = $parser->convert_to_rss($arPost["DETAIL_TEXT"], $arImages, array("HTML" => "Y", "ANCHOR" => "Y", "IMG" => "Y", "SMILES" => "Y", "NL2BR" => "N", "QUOTE" => "Y", "CODE" => "Y"), true, $arParserParams);
1706 else
1707 $text = $parser->convert_to_rss($arPost["DETAIL_TEXT"], $arImages, false, true, $arParserParams);
1708
1709 if($bUserSocNet != "Y")
1710 $text .= "<br /><a href=\"".$url."\">".GetMessage("BLG_GB_RSS_DETAIL")."</a>";
1711 $text = "<![CDATA[".$text."]]>";
1712
1713 if ($type == "rss.92")
1714 {
1715 $rssText .= " <item>\n";
1716 $rssText .= " <title>".$title."</title>\n";
1717 $rssText .= " <description>".$text."</description>\n";
1718 $rssText .= " <link>".$url."</link>\n";
1719 $rssText .= " </item>\n";
1720 $rssText .= "\n";
1721 }
1722 elseif ($type == "rss2.0")
1723 {
1724 $rssText .= " <item>\n";
1725 $rssText .= " <title>".$title."</title>\n";
1726 $rssText .= " <description>".$text."</description>\n";
1727 $rssText .= " <link>".$url."</link>\n";
1728 $rssText .= " <guid>".$url."</guid>\n";
1729 $rssText .= " <pubDate>".$date."</pubDate>\n";
1730 if($category <> '')
1731 $rssText .= " <category>".$category."</category>\n";
1732 $rssText .= " </item>\n";
1733 $rssText .= "\n";
1734 }
1735 elseif ($type == "atom.03")
1736 {
1737 $atomID = "tag:".$serverName.":/".$arPost["ID"];
1738
1739 $timeISO = mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]);
1740 $dateISO = date("Y-m-d\\TH:i:s", $timeISO).mb_substr(date("O", $timeISO), 0, 3).":".mb_substr(date("O", $timeISO), -2, 2);
1741
1742 $titleRel = htmlspecialcharsbx($arPost["TITLE"]);
1743
1744 $rssText .= "<entry>\n";
1745 $rssText .= " <title type=\"text/html\">".$title."</title>\n";
1746 $rssText .= " <link rel=\"alternate\" type=\"text/html\" href=\"".$url."\"/>\n";
1747 $rssText .= " <issued>".$dateISO."</issued>\n";
1748 $rssText .= " <modified>".$nowISO."</modified>\n";
1749 $rssText .= " <id>".$atomID."</id>\n";
1750 $rssText .= " <content type=\"text/html\" mode=\"escaped\" xml:lang=\"".$language."\" xml:base=\"".$blogURL."\">\n";
1751 $rssText .= $text."\n";
1752 $rssText .= " </content>\n";
1753 $rssText .= " <link rel=\"related\" type=\"text/html\" href=\"".$url."\" title=\"".$titleRel."\"/>\n";
1754 $rssText .= " <author>\n";
1755 $rssText .= " <name>".htmlspecialcharsbx($author)."</name>\n";
1756 $rssText .= " <url>".$authorURL."</url>\n";
1757 $rssText .= " </author>\n";
1758 $rssText .= "</entry>\n";
1759 $rssText .= "\n";
1760 }
1761 }
1762
1763 if ($type == "rss.92")
1764 $rssText .= " </channel>\n</rss>";
1765 elseif ($type == "rss2.0")
1766 $rssText .= " </channel>\n</rss>";
1767 elseif ($type == "atom.03")
1768 $rssText .= "\n\n</feed>";
1769
1770 return $rssText;
1771 }
1772
1773 public static function DeleteSocnetRead($ID)
1774 {
1775 global $DB;
1776 $ID = intval($ID);
1777 if($ID <= 0)
1778 return false;
1779 return $DB->Query("DELETE FROM b_blog_socnet WHERE BLOG_ID = ".$ID."", true);
1780 }
1781
1782 public static function GetSocnetReadByBlog($ID)
1783 {
1784 global $DB;
1785 $ID = intval($ID);
1786 if($ID <= 0)
1787 return false;
1788 $dbRes = $DB->Query("select BLOG_ID from b_blog_socnet WHERE BLOG_ID = ".$ID."", true);
1789 if($dbRes -> Fetch())
1790 return true;
1791 return false;
1792 }
1793
1794 public static function SendPing($blogName, $blogUrl, $blogXml = "")
1795 {
1796 if($blogName == '')
1797 return false;
1798 if($blogUrl == '')
1799 return false;
1800
1801 $query = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
1802 <methodCall>
1803 <methodName>weblogUpdates.ping</methodName>
1804 <params>
1805 <param>
1806 <value>".htmlspecialcharsEx($blogName)."</value>
1807 </param>
1808 <param>
1809 <value>".htmlspecialcharsEx($blogUrl)."</value>
1810 </param>";
1811 if($blogXml <> '')
1812 $query .= " <param>
1813 <value>".htmlspecialcharsEx($blogXml)."</value>
1814 </param>";
1815 $query .= " </params>
1816 </methodCall>";
1817
1818 if($urls = COption::GetOptionString("blog", "send_blog_ping_address", "http://ping.blogs.yandex.ru/RPC2\r\nhttp://rpc.weblogs.com/RPC2"))
1819 {
1820 $arUrls = explode("\r\n", $urls);
1821 foreach($arUrls as $v)
1822 {
1823 if($v <> '')
1824 {
1825 $v = str_replace("http://", "", $v);
1826 $pingUrl = str_replace("https://", "", $v);
1827 $arPingUrl = explode("/", $v);
1828
1829 $host = trim($arPingUrl[0]);
1830 unset($arPingUrl[0]);
1831 $path = "/".trim(implode("/", $arPingUrl));
1832
1833 $arHost = explode(":", $host);
1834 $port = ((count($arHost) > 1) ? $arHost[1] : 80);
1835 $host = $arHost[0];
1836
1837 if($host <> '')
1838 {
1839 $fp = @fsockopen($host, $port, $errnum, $errstr, 30);
1840 if ($fp)
1841 {
1842 $out = "";
1843 $out .= "POST ".$path." HTTP/1.1\r\n";
1844 $out .= "Host: ".$host." \r\n";
1845 $out .= "Content-type: text/xml\r\n";
1846 $out .= "User-Agent: bitrixBlog\r\n";
1847 $out .= "Content-length: ".mb_strlen($query)."\r\n\r\n";
1848 $out .= $query;
1849
1850 fwrite($fp, $out);
1851 fclose($fp);
1852 }
1853 }
1854 }
1855 }
1856 }
1857 }
1858
1859 public static function GetWritableSocnetBlogs($user_id = 0, $type = "U", $site_id = SITE_ID)
1860 {
1861 if(CModule::IncludeModule("socialnetwork"))
1862 {
1863 if(intval($user_id) <= 0)
1864 return false;
1865 $user_id = intval($user_id);
1866
1867 global $DB;
1868 if($type == "G")
1869 {
1870 $strSql = "SELECT b.ENTITY_ID as ID, bf.OPERATION_ID, bf.ROLE, bu.USER_ID, blg.NAME as BLOG_NAME, blg.ID as BLOG_ID, g.NAME
1871 FROM b_sonet_features b
1872 INNER JOIN b_sonet_features2perms bf ON (b.ID = bf.FEATURE_ID AND bf.OPERATION_ID in ('write_post', 'full_post', 'premoderate_post', 'moderate_post'))
1873 LEFT JOIN b_blog blg ON blg.SOCNET_GROUP_ID = b.ENTITY_ID
1874 LEFT JOIN b_blog_group blgg ON (blg.GROUP_ID = blgg.ID AND blgg.SITE_ID = '".$DB->ForSql($site_id)."')
1875 LEFT JOIN b_sonet_user2group bu ON (b.ENTITY_ID = bu.GROUP_ID AND bf.ROLE = bu.ROLE AND bu.USER_ID = '".$user_id."')
1876 LEFT JOIN b_sonet_group g on (b.ENTITY_ID = g.ID)
1877 where
1878 b.FEATURE='blog' AND b.ACTIVE='Y' AND b.ENTITY_TYPE = 'G'";
1879 }
1880 else
1881 {
1882 $strSql = "SELECT b.ENTITY_ID as ID, bf.OPERATION_ID, bf.ROLE, ur.FIRST_USER_ID, ur.SECOND_USER_ID, blg.NAME as BLOG_NAME, blg.ID as BLOG_ID, u.LOGIN, u.NAME, u.LAST_NAME
1883 FROM b_sonet_features b
1884 INNER JOIN b_sonet_features2perms bf ON (b.ID = bf.FEATURE_ID AND bf.OPERATION_ID in ('write_post', 'full_post', 'premoderate_post', 'moderate_post'))
1885 LEFT JOIN b_blog blg ON (blg.OWNER_ID = b.ENTITY_ID AND blg.USE_SOCNET = 'Y')
1886 LEFT JOIN b_blog_group blgg ON (blg.GROUP_ID = blgg.ID AND blgg.SITE_ID = '".$DB->ForSql($site_id)."')
1887 LEFT JOIN b_sonet_user_relations ur ON (((ur.FIRST_USER_ID = '".$user_id."' AND ur.SECOND_USER_ID=b.ENTITY_ID)
1888 OR (ur.SECOND_USER_ID = '".$user_id."' AND ur.FIRST_USER_ID=b.ENTITY_ID))
1889 AND ur.RELATION = 'F')
1890 LEFT JOIN b_user u ON (b.ENTITY_ID = u.ID)
1891 where
1892 b.FEATURE='blog' AND b.ACTIVE='Y' AND b.ENTITY_TYPE = 'U'";
1893 }
1894 $dbRes = $DB->Query($strSql);
1895 return $dbRes;
1896 }
1897 return false;
1898
1899 }
1900}
$arParams
Определения access_dialog.php:21
$path
Определения access_edit.php:21
$type
Определения options.php:106
$GLOBALS["BLOG"]
Определения blog.php:5
const BLOG_PERMS_COMMENT
Определения include.php:43
const BLOG_BY_USER_ID
Определения include.php:55
const BLOG_PERMS_POST
Определения include.php:42
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
global $APPLICATION
Определения include.php:80
$arResult
Определения generate_coupon.php:16
static GetByID($ID)
Определения blog_group.php:64
Определения blog.php:10
static GetByOwnerID($ID, $arGroup=Array())
Определения blog.php:968
static GetFilterOperation($key)
Определения blog.php:428
static GetSocnetReadByBlog($ID)
Определения blog.php:1782
static GetBlogUserPostPerms($ID, $userID=0)
Определения blog.php:78
static Delete($ID)
Определения blog.php:266
static SendPing($blogName, $blogUrl, $blogXml="")
Определения blog.php:1794
static GetBlogUserCommentPerms($ID, $userID)
Определения blog.php:112
static BuildRSSAll($GroupId=0, $type="RSS .92", $numPosts=10, $siteID=SITE_ID, $postTemplate="", $userTemplate="", $arAvBlog=Array(), $arPathTemplates=Array(), $arGroupID=Array(), $bUserSocNet="N")
Определения blog.php:1509
static GetWritableSocnetBlogs($user_id=0, $type="U", $site_id=SITE_ID)
Определения blog.php:1859
static GetByID($ID)
Определения blog.php:931
static PrepareSql(&$arFields, $arOrder, &$arFilter, $arGroupBy, $arSelectFields, $obUserFieldsSql=false)
Определения blog.php:487
static CanUserCreateBlog($userID=0)
Определения blog.php:27
static DeleteSocnetRead($ID)
Определения blog.php:1773
static CheckFields($ACTION, &$arFields, $ID=0)
Определения blog.php:145
static BuildRSS($ID, $type="RSS .92", $numPosts=10, $blogTemplate="", $postTemplate="", $userTemplate="", $bSoNet=false, $arParams=Array())
Определения blog.php:1137
static GetBySocNetGroupID($ID, $arGroup=Array())
Определения blog.php:1082
static SetBlogPerms($ID, $arPerms=array(), $permsType=BLOG_PERMS_POST)
Определения blog.php:343
static CanUserManageBlog($ID, $userID=0)
Определения blog.php:59
static IsBlogOwner($ID, $userID)
Определения blog.php:11
static GetByUrl($BLOG_URL, $arGroup=Array())
Определения blog.php:1026
static CanUserViewBlogs($arUserGroups=array())
Определения blog.php:47
static PreparePath($blogUrl, $siteID=False, $is404=True, $userID=0, $groupID=0)
Определения blog.php:1453
static IsFriend($ID, $userID)
Определения blog.php:1490
static SetStat($ID)
Определения blog.php:389
static Delete($ID)
Определения blog_image.php:143
static GetPostID($postID, $code, $allowCode=false)
Определения blog_post.php:1219
static GetBlogUserPostPerms($id, $userId)
Определения blog_post.php:109
static PreparePath($blogUrl, $postID=0, $siteID=False, $is404=True, $userID=0, $groupID=0)
Определения blog_post.php:620
static GetUserPerms($arGroups, $blogID, $postID=0, $permsType=BLOG_PERMS_POST, $selectType=BLOG_BY_BLOG_USER_ID)
Определения blog_user.php:501
static IsLocked($userID)
Определения blog_user.php:13
static GetUserName($alias, $name, $lastName, $login, $secondName="")
Определения blog_user.php:569
static GetUserGroups($ID, $blogID, $joinStatus="", $selectType=BLOG_BY_BLOG_USER_ID, $bUrl=false)
Определения blog_user.php:436
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 DeleteIndex($MODULE_ID, $ITEM_ID=false, $PARAM1=false, $PARAM2=false, $SITE_ID=false)
Определения search.php:2922
static GetList($arOrder=Array("ID"=> "DESC"), $arFilter=Array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения blog.php:249
static Update($ID, $arFields)
Определения blog.php:117
static GetList($arOrder=Array("ID"=> "DESC"), $arFilter=Array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения blog_image.php:122
static GetList( $arOrder=["ID"=> "DESC"], $arFilter=[], $arGroupBy=false, $arNavStartParams=false, $arSelectFields=[])
Определения blog_post.php:554
static GetList($arOrder=Array("ID"=> "DESC"), $arFilter=Array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения blog_site_path.php:97
static Add($arFields)
Определения blog_user_group_perms.php:8
static GetList($arOrder=Array("ID"=> "DESC"), $arFilter=Array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения blog_user_group_perms.php:104
static Update($ID, $arFields)
Определения blog_user_group_perms.php:54
static GetList($arOrder=Array("ID"=> "DESC"), $arFilter=Array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения blog_user.php:249
Определения functions.php:6
$arFields
Определения dblapprove.php:5
$arPath
Определения file_edit.php:72
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$arGroups
Определения options.php:1766
$res
Определения filter_act.php:7
GetFilterQuery($field, $val, $procent="Y", $ex_sep=array(), $clob="N", $div_fields="Y", $clob_upper="N")
Определения filter_tools.php:383
$result
Определения get_property_values.php:14
$query
Определения get_search.php:11
if($ajaxMode) $ID
Определения get_user.php:27
$host
Определения .description.php:9
$arPaths
Определения options.php:169
global $DB
Определения cron_frame.php:29
$siteID
Определения cron_frame.php:12
global $USER
Определения csv_new_run.php:40
$ACTION
Определения csv_new_setup.php:27
const SITE_CHARSET
Определения include.php:62
$groups
Определения options.php:30
ExecuteModuleEventEx($arEvent, $arParams=[])
Определения tools.php:5214
ParseDateTime($datetime, $format=false)
Определения tools.php:638
DelDuplicateSort(&$arSort)
Определения tools.php:2055
htmlspecialcharsEx($str)
Определения tools.php:2685
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
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
$order
Определения payment.php:8
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
if(empty($signedUserToken)) $key
Определения quickway.php:257
$text
Определения template_pdf.php:79
$dateISO
Определения result_rec.php:112
$i
Определения factura.php:643
</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
$title
Определения pdf.php:123
$val
Определения options.php:1793
const SONET_ENTITY_GROUP
Определения include.php:117
const SONET_ENTITY_USER
Определения include.php:118
$site_id
Определения sonet_set_content_view.php:9
const SITE_ID
Определения sonet_set_content_view.php:12
$GLOBALS['_____370096793']
Определения update_client.php:1
$dbResult
Определения updtr957.php:3
$arFilter
Определения user_search.php:106
$url
Определения iframe.php:7
$dbRes
Определения yandex_detail.php:168