1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
user.php
См. документацию.
1<?php
2
6
8
10{
11 public static function OnUserDelete($ID)
12 {
13 global $APPLICATION;
14
15 if (!CSocNetGroup::__ValidateID($ID))
16 {
17 return false;
18 }
19
20 $ID = (int)$ID;
21 $bSuccess = True;
22
23 if (!CSocNetGroup::DeleteNoDemand($ID))
24 {
25 if($ex = $APPLICATION->GetException())
26 {
27 $APPLICATION->ThrowException($ex->GetString());
28 }
29 $bSuccess = false;
30 }
31
32 if ($bSuccess)
33 {
38 CSocNetUserToGroup::DeleteNoDemand($ID);
42 CSocNetFeatures::DeleteNoDemand($ID);
43 CSocNetSubscription::DeleteEx($ID);
46
47 CUserOptions::DeleteOption("socialnetwork", "~menu_".SONET_ENTITY_USER."_".$ID, false, 0);
48 }
49
50 return $bSuccess;
51 }
52
53 public static function OnBeforeUserUpdate(&$arFields)
54 {
55 $rsUser = CUser::GetByID($arFields["ID"]);
56 if (($arUser = $rsUser->Fetch()) && !defined("GLOBAL_ACTIVE_VALUE"))
57 {
58 define("GLOBAL_ACTIVE_VALUE", $arUser["ACTIVE"]);
59 }
60 }
61
62 public static function OnAfterUserAdd(&$arFields)
63 {
64 return;
65 }
66
67 public static function OnAfterUserLogout(&$arParams)
68 {
69 \CSocNetUser::DisableModuleAdmin();
70 }
71
72 public static function OnAfterUserUpdate(&$arFields)
73 {
74 if (
75 array_key_exists("ACTIVE", $arFields)
76 && defined("GLOBAL_ACTIVE_VALUE")
77 && GLOBAL_ACTIVE_VALUE != $arFields["ACTIVE"]
78 )
79 {
80 $arGroups = array();
81 $dbResult = CSocNetUserToGroup::GetList(
82 array(),
83 array(
84 "USER_ID" => $arFields["ID"]
85 ),
86 false,
87 false,
88 array("GROUP_ID")
89 );
90 while ($arResult = $dbResult->Fetch())
91 {
92 $arGroups[] = $arResult["GROUP_ID"];
93 }
94
95 foreach ($arGroups as $group)
96 {
97 CSocNetGroup::SetStat($group);
98 }
99 }
100 }
101
102 public static function OnBeforeProlog()
103 {
104 global $USER;
105
106 if (!$USER->IsAuthorized())
107 return;
108
109 CUser::SetLastActivityDate($USER->GetID(), true);
110 }
111
112 public static function OnUserInitialize($user_id, $arFields = array())
113 {
114 global $CACHE_MANAGER;
115
116 if ((int)$user_id <= 0)
117 {
118 return false;
119 }
120
121 $bIM = Loader::includeModule('im');
122
123 $dbRelation = CSocNetUserToGroup::GetList(
124 array(),
125 array(
126 "USER_ID" => $user_id,
127 "ROLE" => SONET_ROLES_REQUEST,
128 "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP
129 ),
130 false,
131 false,
132 array("ID", "GROUP_ID")
133 );
134 while ($arRelation = $dbRelation->Fetch())
135 {
136 if (
137 CSocNetUserToGroup::UserConfirmRequestToBeMember($user_id, $arRelation["ID"], false)
138 && defined("BX_COMP_MANAGED_CACHE")
139 )
140 {
141 $CACHE_MANAGER->ClearByTag("sonet_user2group_G".$arRelation["GROUP_ID"]);
142 $CACHE_MANAGER->ClearByTag("sonet_user2group_U".$user_id);
143 $CACHE_MANAGER->ClearByTag("sonet_user2group");
144 if ($bIM)
145 {
146 CIMNotify::DeleteByTag("SOCNET|INVITE_GROUP|".$user_id."|". (int)$arRelation["ID"]);
147 }
148 }
149 }
150 }
151
152 public static function IsOnLine($userID)
153 {
154 $userID = (int)$userID;
155 if ($userID <= 0)
156 {
157 return false;
158 }
159
160 return CUser::IsOnLine($userID); // TODO change to use CUser::GetOnlineStatus see more in docs.bx
161 }
162
163 public static function IsFriendsAllowed()
164 {
165 return (COption::GetOptionString("socialnetwork", "allow_frields", "Y") === "Y");
166 }
167
168 public static function IsFriendsFriendsAllowed()
169 {
170 return (COption::GetOptionString("socialnetwork", "allow_frields_friends", "Y") === "Y");
171 }
172
177 public static function IsEnabledModuleAdmin(): bool
178 {
179 return isset(Application::getInstance()->getKernelSession()['SONET_ADMIN']);
180 }
181
186 public static function EnableModuleAdmin(): void
187 {
188 Application::getInstance()->getKernelSession()['SONET_ADMIN'] = 'Y';
189 }
190
195 public static function DisableModuleAdmin(): void
196 {
197 unset(Application::getInstance()->getKernelSession()['SONET_ADMIN']);
198 }
199
200 public static function IsCurrentUserModuleAdmin($site_id = SITE_ID, $bUseSession = true)
201 {
202 global $APPLICATION, $USER;
203
204 static $cache = [];
205
206 if (!is_object($USER) || !$USER->IsAuthorized())
207 {
208 return false;
209 }
210
211 $result = $USER->isAdmin();
212
213 if (!$result && $bUseSession && !CSocNetUser::IsEnabledModuleAdmin())
214 {
215 return false;
216 }
217
218 if (!$result)
219 {
220 $cacheKey = is_array($site_id) ? serialize($site_id) : ($site_id ?: 'false');
221
222 if (!isset($cache[$cacheKey]))
223 {
224 $result = false;
225
226 if (is_array($site_id))
227 {
228 foreach ($site_id as $site_id_tmp)
229 {
230 $modulePerms = $APPLICATION->GetGroupRight("socialnetwork", false, "Y", "Y", array($site_id_tmp, false));
231 if ($modulePerms >= "W")
232 {
233 $result = true;
234 break;
235 }
236 }
237 }
238 else
239 {
240 $modulePerms = $APPLICATION->GetGroupRight("socialnetwork", false, "Y", "Y", ($site_id ? array($site_id, false) : false));
241 $result = ($modulePerms >= "W");
242 }
243
244 $cache[$cacheKey] = $result;
245 }
246 else
247 {
248 $result = $cache[$cacheKey];
249 }
250 }
251
252 return $result && (!$bUseSession || CSocNetUser::IsEnabledModuleAdmin());
253 }
254
255 public static function IsUserModuleAdmin($userID, $site_id = SITE_ID)
256 {
257 if ($userID <= 0)
258 {
259 return false;
260 }
261
262 if ($site_id && !is_array($site_id))
263 {
264 $site_id = array($site_id, false);
265 }
266 elseif ($site_id && is_array($site_id))
267 {
268 $site_id = array_merge($site_id, array(false));
269 }
270
272
273 return (array_key_exists($userID, $arModuleAdmin));
274 }
275
276 public static function DeleteUserAdminCache()
277 {
278 BXClearCache(true, "/sonet/user_admin/");
279 }
280
281 public static function FormatName($name, $lastName, $login)
282 {
283 $name = Trim($name);
284 $lastName = Trim($lastName);
285 $login = Trim($login);
286
287 $formatName = $name;
288 if ($formatName <> '' && $lastName <> '')
289 {
290 $formatName .= " ";
291 }
292 $formatName .= $lastName;
293 if ($formatName == '')
294 {
295 $formatName = $login;
296 }
297
298 return $formatName;
299 }
300
301 public static function FormatNameEx($name, $secondName, $lastName, $login, $email, $id)
302 {
303 $name = Trim($name);
304 $lastName = Trim($lastName);
305 $secondName = Trim($secondName);
306 $login = Trim($login);
307 $email = Trim($email);
308 $id = (int)$id;
309
310 $formatName = $name;
311 if ($formatName <> '' && $secondName <> '')
312 {
313 $formatName .= " ";
314 }
315 $formatName .= $secondName;
316 if ($formatName <> '' && $lastName <> '')
317 {
318 $formatName .= " ";
319 }
320 $formatName .= $lastName;
321 if ($formatName == '')
322 {
323 $formatName = $login;
324 }
325
326 if ($email <> '')
327 {
328 $formatName .= " &lt;" . $email . "&gt;";
329 }
330 $formatName .= " [".$id."]";
331
332 return $formatName;
333 }
334
335 public static function SearchUser($user, $bIntranet = false)
336 {
337 $user = Trim($user);
338 if ($user == '')
339 return false;
340
341 $userID = 0;
342 if ($user."|" == (int)$user ."|")
343 {
344 $userID = (int)$user;
345 }
346
347 if ($userID <= 0)
348 {
349 $arMatches = array();
350 if (preg_match("#\[(\d+)\]#i", $user, $arMatches))
351 {
352 $userID = (int)$arMatches[1];
353 }
354 }
355
356
357 $dbUsers = false;
358 if ($userID > 0)
359 {
360 $arFilter = array("ID_EQUAL_EXACT" => $userID);
361
362 $dbUsers = CUser::GetList(
363 "LAST_NAME",
364 "asc",
365 $arFilter,
366 array(
367 "NAV_PARAMS" => false,
368 )
369 );
370 }
371 else
372 {
373 $email = "";
374 $arMatches = array();
375 if (preg_match("#<(.+?)>#i", $user, $arMatches))
376 {
377
378 if (check_email($arMatches[1]))
379 {
380 $email = $arMatches[1];
381 $user = Trim(Str_Replace("<".$email.">", "", $user));
382 }
383 }
384
385 $arUser = array();
386 $arUserTmp = Explode(" ", $user);
387 foreach ($arUserTmp as $s)
388 {
389 $s = Trim($s);
390 if ($s <> '')
391 {
392 $arUser[] = $s;
393 }
394 }
395
396 if (
397 count($arUser) <= 0
398 && $email <> ''
399 )
400 {
402 "ACTIVE" => "Y",
403 "EMAIL" => $email,
404 );
405 $dbUsers = CUser::GetList("id", "asc", $arFilter);
406 }
407 else
408 {
409 $dbUsers = CUser::SearchUserByName($arUser, $email);
410 }
411 }
412
413 if ($dbUsers)
414 {
415 $arResult = array();
416 while ($arUsers = $dbUsers->GetNext())
417 {
418 $arResult[$arUsers["ID"]] = CSocNetUser::FormatNameEx(
419 $arUsers["NAME"],
420 $arUsers["SECOND_NAME"],
421 $arUsers["LAST_NAME"],
422 $arUsers["LOGIN"],
423 ($bIntranet ? $arUsers["EMAIL"] : ""),
424 $arUsers["ID"]
425 );
426 }
427
428 return $arResult;
429 }
430
431 return false;
432 }
433
434 public static function GetByID($ID)
435 {
436 $ID = (int)$ID;
437
438 $dbUser = CUser::GetByID($ID);
439 if ($arUser = $dbUser->GetNext())
440 {
441 $arUser["NAME_FORMATTED"] = CUser::FormatName(CSite::GetNameFormat(false), $arUser);
442 $arUser["~NAME_FORMATTED"] = htmlspecialcharsback($arUser["NAME_FORMATTED"]);
443 return $arUser;
444 }
445 else
446 {
447 return false;
448 }
449 }
450
451 public static function GetFields($bAdditional = false)
452 {
453 $arRes = array(
454 "ID" => GetMessage("SONET_UP1_ID"),
455 "LOGIN" => GetMessage("SONET_UP1_LOGIN"),
456 "NAME" => GetMessage("SONET_UP1_NAME"),
457 "SECOND_NAME" => GetMessage("SONET_UP1_SECOND_NAME"),
458 "LAST_NAME" => GetMessage("SONET_UP1_LAST_NAME"),
459 "EMAIL" => GetMessage("SONET_UP1_EMAIL"),
460 "TIME_ZONE" => GetMessage("SONET_UP1_TIME_ZONE"),
461 "LAST_LOGIN" => GetMessage("SONET_UP1_LAST_LOGIN"),
462 "LAST_ACTIVITY_DATE" => GetMessage("SONET_UP1_LAST_ACTIVITY_DATE"),
463 "DATE_REGISTER" => GetMessage("SONET_UP1_DATE_REGISTER"),
464 "LID" => GetMessage("SONET_UP1_LID"),
465 "PASSWORD" => GetMessage("SONET_UP1_PASSWORD"),
466 "PERSONAL_BIRTHDAY" => GetMessage("SONET_UP1_PERSONAL_BIRTHDAY"),
467 "PERSONAL_BIRTHDAY_YEAR" => GetMessage("SONET_UP1_PERSONAL_BIRTHDAY_YEAR"),
468 "PERSONAL_BIRTHDAY_DAY" => GetMessage("SONET_UP1_PERSONAL_BIRTHDAY_DAY"),
469
470 "PERSONAL_PROFESSION" => GetMessage("SONET_UP1_PERSONAL_PROFESSION"),
471 "PERSONAL_WWW" => GetMessage("SONET_UP1_PERSONAL_WWW"),
472 "PERSONAL_ICQ" => GetMessage("SONET_UP1_PERSONAL_ICQ"),
473 "PERSONAL_GENDER" => GetMessage("SONET_UP1_PERSONAL_GENDER"),
474 "PERSONAL_PHOTO" => GetMessage("SONET_UP1_PERSONAL_PHOTO"),
475 "PERSONAL_NOTES" => GetMessage("SONET_UP1_PERSONAL_NOTES"),
476
477 "PERSONAL_PHONE" => GetMessage("SONET_UP1_PERSONAL_PHONE"),
478 "PERSONAL_FAX" => GetMessage("SONET_UP1_PERSONAL_FAX"),
479 "PERSONAL_MOBILE" => GetMessage("SONET_UP1_PERSONAL_MOBILE"),
480 "PERSONAL_PAGER" => GetMessage("SONET_UP1_PERSONAL_PAGER"),
481
482 "PERSONAL_COUNTRY" => GetMessage("SONET_UP1_PERSONAL_COUNTRY"),
483 "PERSONAL_STATE" => GetMessage("SONET_UP1_PERSONAL_STATE"),
484 "PERSONAL_CITY" => GetMessage("SONET_UP1_PERSONAL_CITY"),
485 "PERSONAL_ZIP" => GetMessage("SONET_UP1_PERSONAL_ZIP"),
486 "PERSONAL_STREET" => GetMessage("SONET_UP1_PERSONAL_STREET"),
487 "PERSONAL_MAILBOX" => GetMessage("SONET_UP1_PERSONAL_MAILBOX"),
488
489 "WORK_COMPANY" => GetMessage("SONET_UP1_WORK_COMPANY"),
490 "WORK_DEPARTMENT" => GetMessage("SONET_UP1_WORK_DEPARTMENT"),
491 "WORK_POSITION" => GetMessage("SONET_UP1_WORK_POSITION"),
492 "WORK_WWW" => GetMessage("SONET_UP1_WORK_WWW"),
493 "WORK_PROFILE" => GetMessage("SONET_UP1_WORK_PROFILE"),
494 "WORK_LOGO" => GetMessage("SONET_UP1_WORK_LOGO"),
495 "WORK_NOTES" => GetMessage("SONET_UP1_WORK_NOTES"),
496
497 "WORK_PHONE" => GetMessage("SONET_UP1_WORK_PHONE"),
498 "WORK_FAX" => GetMessage("SONET_UP1_WORK_FAX"),
499 "WORK_PAGER" => GetMessage("SONET_UP1_WORK_PAGER"),
500
501 "WORK_COUNTRY" => GetMessage("SONET_UP1_WORK_COUNTRY"),
502 "WORK_STATE" => GetMessage("SONET_UP1_WORK_STATE"),
503 "WORK_CITY" => GetMessage("SONET_UP1_WORK_CITY"),
504 "WORK_ZIP" => GetMessage("SONET_UP1_WORK_ZIP"),
505 "WORK_STREET" => GetMessage("SONET_UP1_WORK_STREET"),
506 "WORK_MAILBOX" => GetMessage("SONET_UP1_WORK_MAILBOX"),
507 );
508
509 if (ModuleManager::isModuleInstalled('forum'))
510 {
511 $arRes["FORUM_SHOW_NAME"] = GetMessage("SONET_UP1_FORUM_PREFIX").GetMessage("SONET_UP1_FORUM_SHOW_NAME");
512 $arRes["FORUM_DESCRIPTION"] = GetMessage("SONET_UP1_FORUM_PREFIX").GetMessage("SONET_UP1_FORUM_DESCRIPTION");
513 $arRes["FORUM_INTERESTS"] = GetMessage("SONET_UP1_FORUM_PREFIX").GetMessage("SONET_UP1_FORUM_INTERESTS");
514 $arRes["FORUM_SIGNATURE"] = GetMessage("SONET_UP1_FORUM_PREFIX").GetMessage("SONET_UP1_FORUM_SIGNATURE");
515 $arRes["FORUM_AVATAR"] = GetMessage("SONET_UP1_FORUM_PREFIX").GetMessage("SONET_UP1_FORUM_AVATAR");
516 $arRes["FORUM_HIDE_FROM_ONLINE"] = GetMessage("SONET_UP1_FORUM_PREFIX").GetMessage("SONET_UP1_FORUM_HIDE_FROM_ONLINE");
517 $arRes["FORUM_SUBSC_GET_MY_MESSAGE"] = GetMessage("SONET_UP1_FORUM_PREFIX").GetMessage("SONET_UP1_FORUM_SUBSC_GET_MY_MESSAGE");
518 }
519
520 if (ModuleManager::isModuleInstalled('blog'))
521 {
522 $arRes["BLOG_ALIAS"] = GetMessage("SONET_UP1_BLOG_PREFIX").GetMessage("SONET_UP1_BLOG_ALIAS");
523 $arRes["BLOG_DESCRIPTION"] = GetMessage("SONET_UP1_BLOG_PREFIX").GetMessage("SONET_UP1_BLOG_DESCRIPTION");
524 $arRes["BLOG_INTERESTS"] = GetMessage("SONET_UP1_BLOG_PREFIX").GetMessage("SONET_UP1_BLOG_INTERESTS");
525 $arRes["BLOG_AVATAR"] = GetMessage("SONET_UP1_BLOG_PREFIX").GetMessage("SONET_UP1_BLOG_AVATAR");
526 }
527
528 return $arRes;
529 }
530
531 public static function GetFieldsMap($bAdditional = false)
532 {
533 $arUserFields = CSocNetUser::GetFields($bAdditional);
534 return array_keys($arUserFields);
535 }
536
537 public static function CanProfileView($currentUserId, $arUser, $siteId = SITE_ID, $arContext = [])
538 {
539 global $USER;
540
541 if (
542 !is_array($arUser)
543 && (int)$arUser > 0
544 )
545 {
546 $dbUser = \CUser::getById((int)$arUser);
547 $arUser = $dbUser->fetch();
548 }
549
550 if (
551 !is_array($arUser)
552 || !isset($arUser["ID"])
553 || (int)$arUser["ID"] <= 0
554 )
555 {
556 return false;
557 }
558
559 if (
560 (int)$currentUserId === (int)$USER->GetId()
561 && self::isCurrentUserModuleAdmin()
562 )
563 {
564 return true;
565 }
566
567 if (self::OnGetProfileView($currentUserId, $arUser, $siteId, $arContext)) // only for email users
568 {
569 return true;
570 }
571
572 if (self::isCalendarSharingUser($currentUserId, $arUser, $siteId, $arContext)) // only for calendar sharing users
573 {
574 return true;
575 }
576
577 $bFound = false;
578 foreach(GetModuleEvents("socialnetwork", "OnGetProfileView", true) as $arEvent)
579 {
580 if (ModuleManager::isModuleInstalled($arEvent['TO_MODULE_ID']))
581 {
582 $bFound = true;
583 if (ExecuteModuleEventEx($arEvent, [ $currentUserId, $arUser, $siteId, $arContext, false ]) === true)
584 {
585 return true;
586 }
587 }
588 }
589
590 return (!$bFound);
591 }
592
593 public static function OnGetProfileView($currentUserId, $arUser, $siteId, $arContext)
594 {
595 if (!ModuleManager::isModuleInstalled('mail'))
596 {
597 return false;
598 }
599
600 $currentUserId = (int)$currentUserId;
601
602 if (
603 $currentUserId <= 0
604 || !is_array($arUser)
605 )
606 {
607 return false;
608 }
609
610 if (
611 isset($arUser['EXTERNAL_AUTH_ID'])
612 && $arUser['EXTERNAL_AUTH_ID'] === 'email'
613 && Loader::includeModule('intranet')
614 )
615 {
616 $res = \Bitrix\Intranet\UserTable::getList([
617 'filter' => [
618 '=ID' => $currentUserId,
619 ],
620 'select' => [ 'USER_TYPE' ],
621 ]);
622
623 if (
624 ($currentUserFields = $res->fetch())
625 && $currentUserFields['USER_TYPE'] === 'employee'
626 )
627 {
628 return true;
629 }
630 }
631
632 if (
633 !isset($arContext['ENTITY_TYPE'], $arContext['ENTITY_ID'], $arUser['ID'])
634 || (int)$arContext['ENTITY_ID'] <= 0
635 || $arContext['ENTITY_TYPE'] !== 'LOG_ENTRY'
636 || (int)$arUser['ID'] <= 0
637 )
638 {
639 return false;
640 }
641
642 if (
643 (
644 isset($arUser['EXTERNAL_AUTH_ID'])
645 && $arUser['EXTERNAL_AUTH_ID'] === 'email'
646 ) // -> email user
647 ||
648 (
649 ($res = \CUser::getById($currentUserId))
650 && ($currentUserFields = $res->fetch())
651 && ($currentUserFields['EXTERNAL_AUTH_ID'] === 'email')
652 ) // email user ->
653 )
654 {
655 return self::CheckContext($currentUserId, $arUser['ID'], $arContext);
656 }
657
658 return false;
659 }
660
661 private static function isCalendarSharingUser($currentUserId, $arUser, $siteId, $arContext)
662 {
663 if (!ModuleManager::isModuleInstalled('calendar'))
664 {
665 return false;
666 }
667
668 $currentUserId = (int)$currentUserId;
669
670 if (
671 $currentUserId <= 0
672 || !is_array($arUser)
673 )
674 {
675 return false;
676 }
677
678 if (
679 isset($arUser['EXTERNAL_AUTH_ID'])
680 && $arUser['EXTERNAL_AUTH_ID'] === 'calendar_sharing'
681 && Loader::includeModule('intranet')
682 )
683 {
684 $res = \Bitrix\Intranet\UserTable::getList([
685 'filter' => [
686 '=ID' => $currentUserId,
687 ],
688 'select' => [ 'USER_TYPE' ],
689 ]);
690
691 if (
692 ($currentUserFields = $res->fetch())
693 && $currentUserFields['USER_TYPE'] === 'employee'
694 )
695 {
696 return true;
697 }
698 }
699
700 if (
701 !isset($arContext['ENTITY_TYPE'], $arContext['ENTITY_ID'], $arUser['ID'])
702 || (int)$arContext['ENTITY_ID'] <= 0
703 || $arContext['ENTITY_TYPE'] !== 'LOG_ENTRY'
704 || (int)$arUser['ID'] <= 0
705 )
706 {
707 return false;
708 }
709
710 if (
711 (
712 isset($arUser['EXTERNAL_AUTH_ID'])
713 && $arUser['EXTERNAL_AUTH_ID'] === 'calendar_sharing'
714 ) // -> calendar_sharing user
715 ||
716 (
717 ($res = \CUser::getById($currentUserId))
718 && ($currentUserFields = $res->fetch())
719 && ($currentUserFields['EXTERNAL_AUTH_ID'] === 'calendar_sharing')
720 ) // calendar_sharing user ->
721 )
722 {
723 return self::CheckContext($currentUserId, $arUser['ID'], $arContext);
724 }
725
726 return false;
727 }
728
729 public static function CheckContext($currentUserId = false, $userId = false, $arContext = array())
730 {
731 if (
732 (int)$currentUserId <= 0
733 || (int)$userId <= 0
734 || !is_array($arContext)
735 || empty($arContext["ENTITY_TYPE"])
736 || empty($arContext["ENTITY_ID"])
737 )
738 {
739 return false;
740 }
741
742 if ($arContext["ENTITY_TYPE"] === "LOG_ENTRY")
743 {
745 array(),
746 array(
747 "LOG_ID" => (int)$arContext["ENTITY_ID"]
748 )
749 );
750
751 $arLogEntryUserId = $arSonetGroupId = $arDepartmentId = array();
752 $bIntranetInstalled = ModuleManager::IsModuleInstalled('intranet');
753
754 while ($arRes = $dbRes->Fetch())
755 {
756 if (preg_match('/^U(\d+)$/', $arRes["GROUP_CODE"], $matches))
757 {
758 $arLogEntryUserId[] = $matches[1];
759 }
760 elseif (
761 preg_match('/^SG(\d+)$/', $arRes["GROUP_CODE"], $matches)
762 || preg_match('/^SG(\d+)_'.SONET_ROLES_USER.'$/', $arRes["GROUP_CODE"], $matches)
763 && !in_array($matches[1], $arSonetGroupId)
764 )
765 {
766 $arSonetGroupId[] = $matches[1];
767 }
768 elseif (
769 $bIntranetInstalled
770 && preg_match('/^DR(\d+)$/', $arRes["GROUP_CODE"], $matches)
771 && !in_array($matches[1], $arDepartmentId)
772 )
773 {
774 $arDepartmentId[] = $matches[1];
775 }
776 elseif ($arRes["GROUP_CODE"] === 'G2')
777 {
778 if (!empty($arContext['SITE_ID']))
779 {
780 $arLogSite = array();
781 $rsSite = CSocNetLog::GetSite((int)$arContext["ENTITY_ID"]);
782 while ($arSite = $rsSite->Fetch())
783 {
784 $arLogSite[] = $arSite["SITE_ID"];
785 }
786
787 return in_array($arContext['SITE_ID'], $arLogSite);
788 }
789 }
790 }
791
792 if (
793 in_array($currentUserId, $arLogEntryUserId)
794 && in_array($userId, $arLogEntryUserId)
795 )
796 {
797 return true;
798 }
799
800 if (in_array($userId, $arLogEntryUserId))
801 {
802 if (!empty($arSonetGroupId))
803 {
804 foreach($arSonetGroupId as $groupId)
805 {
806 if (CSocNetUserToGroup::GetUserRole($currentUserId, $groupId) <= SONET_ROLES_USER)
807 {
808 return true;
809 }
810 }
811 }
812
813 if (
814 !empty($arDepartmentId)
815 && Loader::includeModule('intranet')
816 )
817 {
818 $arDepartmentUserId = array();
819
820 $rsDepartmentUserId = \Bitrix\Intranet\Util::getDepartmentEmployees(array(
821 'DEPARTMENTS' => $arDepartmentId,
822 'RECURSIVE' => 'Y',
823 'ACTIVE' => 'Y',
824 'CONFIRMED' => 'Y',
825 'SELECT' => array('ID')
826 ));
827
828 while ($arUser = $rsDepartmentUserId->Fetch())
829 {
830 $arDepartmentUserId[] = $arUser["ID"];
831 }
832
833 if (in_array($currentUserId, $arDepartmentUserId))
834 {
835 return true;
836 }
837 }
838 }
839
840 $rsLog = CSocNetLog::GetList(
841 array(),
842 array(
843 "ID" => (int)$arContext["ENTITY_ID"]
844 ),
845 false,
846 false,
847 array(
848 "USER_ID"
849 )
850 );
851 if ($arLog = $rsLog->Fetch())
852 {
853 return (
854 (
855 in_array($currentUserId, $arLogEntryUserId)
856 && ($userId == $arLog["USER_ID"])
857 )
858 || (
859 in_array($userId, $arLogEntryUserId)
860 && ($currentUserId == $arLog["USER_ID"])
861 )
862 );
863 }
864 }
865
866 return false;
867 }
868}
$arParams
Определения access_dialog.php:21
global $APPLICATION
Определения include.php:80
$arResult
Определения generate_coupon.php:16
$login
Определения change_password.php:8
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
$bIntranet
Определения checklist_structure.php:347
Определения loader.php:13
static deleteNoDemand($userId=0)
Определения usercontentview.php:320
static deleteByGroupCode($value='')
Определения logright.php:97
static getModuleAdminList($siteIdList)
Определения user.php:19
static DeleteNoDemand($userID)
Определения log_comments.php:274
static DeleteNoDemand($userID)
Определения log_events.php:161
static GetSite($log_id)
Определения log.php:1025
static DeleteNoDemand($userID)
Определения messages.php:217
static DeleteNoDemand($userID)
Определения user_events.php:83
Определения user.php:10
static GetFieldsMap($bAdditional=false)
Определения user.php:531
static OnGetProfileView($currentUserId, $arUser, $siteId, $arContext)
Определения user.php:593
static IsUserModuleAdmin($userID, $site_id=SITE_ID)
Определения user.php:255
static OnAfterUserUpdate(&$arFields)
Определения user.php:72
static IsFriendsAllowed()
Определения user.php:163
static GetByID($ID)
Определения user.php:434
static OnUserInitialize($user_id, $arFields=array())
Определения user.php:112
static OnBeforeProlog()
Определения user.php:102
static OnAfterUserAdd(&$arFields)
Определения user.php:62
static SearchUser($user, $bIntranet=false)
Определения user.php:335
static DisableModuleAdmin()
Определения user.php:195
static DeleteUserAdminCache()
Определения user.php:276
static CanProfileView($currentUserId, $arUser, $siteId=SITE_ID, $arContext=[])
Определения user.php:537
static IsEnabledModuleAdmin()
Определения user.php:177
static OnUserDelete($ID)
Определения user.php:11
static IsCurrentUserModuleAdmin($site_id=SITE_ID, $bUseSession=true)
Определения user.php:200
static FormatNameEx($name, $secondName, $lastName, $login, $email, $id)
Определения user.php:301
static IsOnLine($userID)
Определения user.php:152
static IsFriendsFriendsAllowed()
Определения user.php:168
static OnBeforeUserUpdate(&$arFields)
Определения user.php:53
static CheckContext($currentUserId=false, $userId=false, $arContext=array())
Определения user.php:729
static OnAfterUserLogout(&$arParams)
Определения user.php:67
static FormatName($name, $lastName, $login)
Определения user.php:281
static GetFields($bAdditional=false)
Определения user.php:451
static EnableModuleAdmin()
Определения user.php:186
static DeleteNoDemand($userID)
Определения user_perms.php:82
static DeleteNoDemand($userID)
Определения user_relations.php:136
static GetList($arOrder=Array("ID"=> "DESC"), $arFilter=Array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array(), $arParams=array())
Определения log.php:338
static DeleteNoDemand($userID)
Определения log.php:1410
static GetList($aSort=array(), $aFilter=array())
Определения log_rights.php:256
global $CACHE_MANAGER
Определения clear_component_cache.php:7
$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
$arGroups
Определения options.php:1766
$res
Определения filter_act.php:7
$result
Определения get_property_values.php:14
$bFound
Определения get_search.php:40
if($ajaxMode) $ID
Определения get_user.php:27
global $USER
Определения csv_new_run.php:40
$siteId
Определения ajax.php:8
ExecuteModuleEventEx($arEvent, $arParams=[])
Определения tools.php:5214
htmlspecialcharsback($str)
Определения tools.php:2693
GetModuleEvents($MODULE_ID, $MESSAGE_ID, $bReturnArray=false)
Определения tools.php:5177
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
GetMessage($name, $aReplace=null)
Определения tools.php:3397
BXClearCache($full=false, $initdir='')
Определения tools.php:5150
check_email($email, $strict=false, $domainCheck=false)
Определения tools.php:4571
$name
Определения menu_edit.php:35
$email
Определения payment.php:49
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
</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
$matches
Определения index.php:22
const SONET_ROLES_USER
Определения include.php:31
const SONET_ENTITY_USER
Определения include.php:118
const SONET_ROLES_REQUEST
Определения include.php:33
const SONET_INITIATED_BY_GROUP
Определения include.php:45
$arRes
Определения options.php:104
$site_id
Определения sonet_set_content_view.php:9
const SITE_ID
Определения sonet_set_content_view.php:12
$dbResult
Определения updtr957.php:3
$arFilter
Определения user_search.php:106
$dbRes
Определения yandex_detail.php:168