本文整理汇总了PHP中api_Utils::GetDefaultAccount方法的典型用法代码示例。如果您正苦于以下问题:PHP api_Utils::GetDefaultAccount方法的具体用法?PHP api_Utils::GetDefaultAccount怎么用?PHP api_Utils::GetDefaultAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api_Utils
的用法示例。
在下文中一共展示了api_Utils::GetDefaultAccount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Process
public static function Process($mResult)
{
$sSocialRedirect = '';
if (isset($_COOKIE["SocialRedirect"])) {
$sSocialRedirect = $_COOKIE["SocialRedirect"];
@setcookie('SocialRedirect', null);
}
if ($sSocialRedirect === 'helpdesk') {
self::SetValuesToCookie($mResult);
$sTenantHash = self::GetTenantHashFromCookie();
if ($sTenantHash) {
\CApi::Location('./?helpdesk=' . $sTenantHash);
} else {
\CApi::Location('./?helpdesk');
}
} else {
$oAccount = \api_Utils::GetDefaultAccount();
if ($oAccount) {
$oApiSocial = \CApi::Manager('social');
$oSocial = new \CSocial();
$oSocial->IdAccount = $oAccount->IdAccount;
switch ($mResult['type']) {
case 'google':
$oSocial->Type = \ESocialType::Google;
$oSocial->AccessToken = $mResult['access_token'];
$oSocial->RefreshToken = $mResult['refresh_token'];
break;
case 'dropbox':
$oSocial->Type = \ESocialType::Dropbox;
$oSocial->AccessToken = $mResult['access_token'];
break;
}
$oSocial->IdSocial = $mResult['id'];
$oSocial->Name = $mResult['name'];
$bCreateResult = $oApiSocial->CreateSocial($oSocial);
echo "<script>" . "if (typeof(window.opener.servicesSettingsViewModelCallback) !== 'undefined')" . "{" . "window.opener.servicesSettingsViewModelCallback('" . $mResult['type'] . "', " . $bCreateResult . ");" . "window.close();" . "}" . "</script>";
}
}
}
示例2: AjaxSocialAccountListGet
public function AjaxSocialAccountListGet()
{
$mResult['Result'] = false;
$oTenant = null;
$oAccount = \api_Utils::GetDefaultAccount();
$oApiTenants = \CApi::Manager('tenants');
if ($oAccount && $oApiTenants) {
$oTenant = 0 < $oAccount->IdTenant ? $oApiTenants->getTenantById($oAccount->IdTenant) : $oApiTenants->getDefaultGlobalTenant();
}
if ($oTenant) {
$oApiSocial = \CApi::Manager('social');
$mResult['Result'] = $oApiSocial->getSocials($oAccount->IdAccount);
}
return $mResult;
}
示例3: Process
public static function Process($mResult)
{
$sSocialRedirect = '';
if (isset($_COOKIE["SocialRedirect"])) {
$sSocialRedirect = $_COOKIE["SocialRedirect"];
@setcookie('SocialRedirect', null);
}
if ($sSocialRedirect === 'helpdesk') {
self::SetValuesToCookie($mResult);
$sTenantHash = self::GetTenantHashFromCookie();
if ($sTenantHash) {
\CApi::Location('./?helpdesk=' . $sTenantHash);
} else {
\CApi::Location('./?helpdesk');
}
} else {
$oAccount = \api_Utils::GetDefaultAccount();
$oApiSocial = \CApi::Manager('social');
$oSocial = new \CSocial();
switch ($mResult['type']) {
case 'google':
$oSocial->Type = \ESocialType::Google;
$oSocial->AccessToken = $mResult['access_token'];
$oSocial->RefreshToken = $mResult['refresh_token'];
break;
case 'dropbox':
$oSocial->Type = \ESocialType::Dropbox;
$oSocial->AccessToken = $mResult['access_token'];
break;
}
$oSocial->IdSocial = $mResult['id'];
$oSocial->Name = $mResult['name'];
if ($sSocialRedirect === 'login') {
$oSocial->Scopes = 'LOGIN';
$oApiUsers = \CApi::Manager('users');
if (!$oApiSocial->SocialExists($oSocial->Type, $oSocial->IdSocial)) {
$oAccount = $oApiUsers->GetAccountOnLogin($mResult['email']);
if ($oAccount) {
$oSocial->IdAccount = $oAccount->IdAccount;
$oApiSocial->CreateSocial($oSocial);
} else {
// Account does not exist
}
} else {
$oSocial = $oApiSocial->GetSocialById($oSocial->IdSocial, $oSocial->Type);
if ($oSocial && $oSocial->IssetScope('auth')) {
$oAccount = $oApiUsers->GetAccountById($oSocial->IdAccount);
} else {
// Account already exist
}
}
$oApiIntegrator = \CApi::Manager('integrator');
$oApiIntegrator->SetAccountAsLoggedIn($oAccount, true);
\CApi::Location('./');
} else {
if ($oAccount) {
$oSocial->IdAccount = $oAccount->IdAccount;
$bCreateResult = $oApiSocial->CreateSocial($oSocial);
echo "<script>" . "if (typeof(window.opener.servicesSettingsViewModelCallback) !== 'undefined')" . "{" . "window.opener.servicesSettingsViewModelCallback('" . $mResult['type'] . "', " . $bCreateResult . ");" . "window.close();" . "}" . "</script>";
}
}
}
}