当前位置: 首页>>代码示例>>PHP>>正文


PHP api_Utils::GetDefaultAccount方法代码示例

本文整理汇总了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>";
         }
     }
 }
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:39,代码来源:social.php

示例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;
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:15,代码来源:index.php

示例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>";
             }
         }
     }
 }
开发者ID:BertLasker,项目名称:Catch-design,代码行数:63,代码来源:social.php


注:本文中的api_Utils::GetDefaultAccount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。