1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
sonet.php
См. документацию.
1
<?php
2
3
class
CBlogSoNetPost
4
{
5
public
static
function
CanUserDeletePost
(
$ID
, $userID, $blogOwnerID, $groupOwnerID)
6
{
7
$ID
= intval(
$ID
);
8
$userID = intval($userID);
9
$blogOwnerID = intval($blogOwnerID);
10
$groupOwnerID = intval($groupOwnerID);
11
12
$blogModulePermissions =
$GLOBALS
[
"APPLICATION"
]->GetGroupRight(
"blog"
);
13
if
($blogModulePermissions >=
"W"
)
14
return
True;
15
16
$arPost =
CBlogPost::GetByID
(
$ID
);
17
18
if
(empty($arPost))
19
return
False;
20
21
if
($groupOwnerID > 0)
22
{
23
$arBlogUser =
CBlogUser::GetByID
($userID,
BLOG_BY_USER_ID
);
24
if
($arBlogUser && $arBlogUser[
"ALLOW_POST"
] !=
"Y"
)
25
return
False;
26
27
$perms =
BLOG_PERMS_DENY
;
28
if
(CSocNetFeaturesPerms::CanPerformOperation($userID,
SONET_ENTITY_GROUP
, $groupOwnerID,
"blog"
,
"view_post"
))
29
$perms =
BLOG_PERMS_READ
;
30
if
(CSocNetFeaturesPerms::CanPerformOperation($userID,
SONET_ENTITY_GROUP
, $groupOwnerID,
"blog"
,
"write_post"
))
31
$perms =
BLOG_PERMS_WRITE
;
32
if
(CSocNetFeaturesPerms::CanPerformOperation($userID,
SONET_ENTITY_GROUP
, $groupOwnerID,
"blog"
,
"full_post"
))
33
$perms =
BLOG_PERMS_FULL
;
34
35
if
($perms >=
BLOG_PERMS_WRITE
&& $arPost[
"AUTHOR_ID"
] == $userID)
36
return
true
;
37
38
if
($perms >
BLOG_PERMS_WRITE
)
39
return
true
;
40
41
}
42
else
43
{
44
$arBlog =
CBlog::GetByID
($arPost[
"BLOG_ID"
]);
45
46
$arBlogUser =
CBlogUser::GetByID
($userID,
BLOG_BY_USER_ID
);
47
if
($arBlogUser && $arBlogUser[
"ALLOW_POST"
] !=
"Y"
)
48
return
False;
49
50
$perms =
BLOG_PERMS_DENY
;
51
if
(CSocNetFeaturesPerms::CanPerformOperation($userID,
SONET_ENTITY_USER
, $blogOwnerID,
"blog"
,
"view_post"
))
52
$perms =
BLOG_PERMS_READ
;
53
if
(CSocNetFeaturesPerms::CanPerformOperation($userID,
SONET_ENTITY_USER
, $blogOwnerID,
"blog"
,
"write_post"
))
54
$perms =
BLOG_PERMS_WRITE
;
55
if
(CSocNetFeaturesPerms::CanPerformOperation($userID,
SONET_ENTITY_USER
, $blogOwnerID,
"blog"
,
"full_post"
))
56
$perms =
BLOG_PERMS_FULL
;
57
58
if
($perms >=
BLOG_PERMS_WRITE
&& $arPost[
"AUTHOR_ID"
] == $userID)
59
return
true
;
60
61
if
($perms >
BLOG_PERMS_WRITE
)
62
return
true
;
63
}
64
65
return
False;
66
}
67
68
public
static
function
OnGroupDelete
(
$ID
)
69
{
70
$ID
= intval(
$ID
);
71
if
(
$ID
<= 0)
72
return
false
;
73
$arBlog =
CBlog::GetBySocNetGroupID
(
$ID
);
74
if
(!empty($arBlog))
75
{
76
CBlog::Delete
($arBlog[
"ID"
]);
77
}
78
79
\Bitrix\Blog\PostSocnetRightsTable::deleteByEntity
(
'SG'
.
$ID
);
80
\Bitrix\Blog\PostSocnetRightsTable::deleteByEntity
(
'SG'
.
$ID
.
'_A'
);
81
\Bitrix\Blog\PostSocnetRightsTable::deleteByEntity
(
'SG'
.
$ID
.
'_E'
);
82
\Bitrix\Blog\PostSocnetRightsTable::deleteByEntity
(
'SG'
.
$ID
.
'_K'
);
83
\Bitrix\Blog\PostSocnetRightsTable::deleteByEntity
(
'OSG'
.
$ID
.
'_L'
);
84
}
85
}
BLOG_BY_USER_ID
const BLOG_BY_USER_ID
Определения
include.php:55
BLOG_PERMS_DENY
const BLOG_PERMS_DENY
Определения
include.php:5
BLOG_PERMS_WRITE
const BLOG_PERMS_WRITE
Определения
include.php:8
BLOG_PERMS_READ
const BLOG_PERMS_READ
Определения
include.php:6
BLOG_PERMS_FULL
const BLOG_PERMS_FULL
Определения
include.php:10
Bitrix\Blog\PostSocnetRightsTable\deleteByEntity
static deleteByEntity($value='')
Определения
postsocnetrights.php:227
CAllBlog\Delete
static Delete($ID)
Определения
blog.php:266
CAllBlog\GetByID
static GetByID($ID)
Определения
blog.php:931
CAllBlog\GetBySocNetGroupID
static GetBySocNetGroupID($ID, $arGroup=Array())
Определения
blog.php:1082
CAllBlogUser\GetByID
static GetByID($ID, $selectType=BLOG_BY_BLOG_USER_ID)
Определения
blog_user.php:354
CBlogPost\GetByID
static GetByID($ID)
Определения
blog_post.php:511
CBlogSoNetPost
Определения
sonet.php:4
CBlogSoNetPost\CanUserDeletePost
static CanUserDeletePost($ID, $userID, $blogOwnerID, $groupOwnerID)
Определения
sonet.php:5
CBlogSoNetPost\OnGroupDelete
static OnGroupDelete($ID)
Определения
sonet.php:68
$ID
if($ajaxMode) $ID
Определения
get_user.php:27
SONET_ENTITY_GROUP
const SONET_ENTITY_GROUP
Определения
include.php:117
SONET_ENTITY_USER
const SONET_ENTITY_USER
Определения
include.php:118
$GLOBALS
$GLOBALS['_____370096793']
Определения
update_client.php:1
bitrix
modules
blog
general
sonet.php
Создано системой
1.14.0