1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
apmanager.php
См. документацию.
1
<?php
2
namespace
Bitrix\Socialservices;
3
4
use Bitrix\Main\Web\Uri;
5
6
class
ApManager
7
{
8
public
static
function
receive
(
$userId
, $connectionString)
9
{
10
if
(static::checkState())
11
{
12
$connection
= static::parseConnectionString($connectionString);
13
14
if
(
$connection
)
15
{
16
$uri
=
new
Uri
(
$connection
[
'endpoint'
]);
17
18
if
(
$uri
->getHost())
19
{
20
$dbRes
= ApTable::getList(
array
(
21
'filter'
=>
array
(
22
'=USER_ID'
=>
$userId
,
23
'=DOMAIN'
=>
$uri
->getHost()
24
),
25
'select'
=>
array
(
'ID'
)
26
));
27
$existingEntry =
$dbRes
->fetch();
28
if
($existingEntry)
29
{
30
$result
= ApTable::update($existingEntry[
'ID'
],
array
(
31
'ENDPOINT'
=>
$uri
->getLocator(),
32
'LAST_AUTHORIZE'
=>
''
,
33
));
34
}
35
else
36
{
37
$result
= ApTable::add(
array
(
38
'USER_ID'
=>
$userId
,
39
'DOMAIN'
=>
$uri
->getHost(),
40
'ENDPOINT'
=>
$uri
->getLocator(),
41
));
42
}
43
44
return
$result
->isSuccess();
45
}
46
}
47
}
48
49
return
false
;
50
}
51
52
protected
static
function
checkState
()
53
{
54
return \CSocServAuthManager::checkUniqueKey();
55
}
56
57
protected
static
function
parseConnectionString
($connectionString)
58
{
59
$client =
\CBitrix24NetPortalTransport::init
();
60
if
($client)
61
{
62
$result
= $client->call(
'client.authorize'
,
array
(
'apcode'
=> $connectionString));
63
64
if
(
$result
&&
$result
[
'result'
])
65
{
66
return
array
(
67
'endpoint'
=>
$result
[
'result'
][
'ENDPOINT'
],
68
);
69
}
70
}
71
72
return
false
;
73
}
74
}
$connection
$connection
Определения
actionsdefinitions.php:38
$userId
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения
check_mail.php:18
Bitrix\Main\Web\Uri
Определения
uri.php:17
Bitrix\Socialservices\ApManager
Определения
apmanager.php:7
Bitrix\Socialservices\ApManager\parseConnectionString
static parseConnectionString($connectionString)
Определения
apmanager.php:57
Bitrix\Socialservices\ApManager\checkState
static checkState()
Определения
apmanager.php:52
Bitrix\Socialservices\ApManager\receive
static receive($userId, $connectionString)
Определения
apmanager.php:8
CBitrix24NetPortalTransport\init
static init($networkNode=null)
Определения
bitrix24net.php:1102
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$uri
if(file_exists($_SERVER['DOCUMENT_ROOT'] . "/urlrewrite.php")) $uri
Определения
urlrewrite.php:61
$dbRes
$dbRes
Определения
yandex_detail.php:168
bitrix
modules
socialservices
lib
apmanager.php
Создано системой
1.14.0