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


PHP CApi::Location2方法代码示例

本文整理汇总了PHP中CApi::Location2方法的典型用法代码示例。如果您正苦于以下问题:PHP CApi::Location2方法的具体用法?PHP CApi::Location2怎么用?PHP CApi::Location2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CApi的用法示例。


在下文中一共展示了CApi::Location2方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Process

 public static function Process($mResult)
 {
     $sExternalServicesRedirect = '';
     $sError = '';
     $sErrorMessage = '';
     if (isset($_COOKIE["external-services-redirect"])) {
         $sExternalServicesRedirect = $_COOKIE["external-services-redirect"];
         @setcookie('external-services-redirect', null);
     }
     if ($sExternalServicesRedirect === 'helpdesk') {
         self::SetValuesToCookie($mResult);
         $sTenantHash = self::GetTenantHashFromCookie();
         \CApi::Location($sTenantHash ? './?helpdesk=' . $sTenantHash : './?helpdesk');
     } else {
         $oApiUsers = \CApi::Manager('users');
         $oInviteAccount = null;
         if (isset($_COOKIE["external-services-invite-hash"])) {
             $oInviteAccount = $oApiUsers->getAccountById($_COOKIE["external-services-invite-hash"], true);
             @setcookie('external-services-invite-hash', null);
         }
         $sEmail = trim($mResult['email']);
         if (empty($sEmail) && $oInviteAccount) {
             $mResult['email'] = $oInviteAccount->Email;
         }
         $oApiSocial = \CApi::Manager('social');
         $oSocial = new \CSocial();
         $oSocial->TypeStr = $mResult['type'];
         $oSocial->AccessToken = isset($mResult['access_token']) ? $mResult['access_token'] : '';
         $oSocial->RefreshToken = isset($mResult['refresh_token']) ? $mResult['refresh_token'] : '';
         $oSocial->IdSocial = $mResult['id'];
         $oSocial->Name = $mResult['name'];
         $oSocial->Email = $mResult['email'];
         if ($sExternalServicesRedirect === 'login') {
             self::SetValuesToCookie($mResult);
             $oSocialOld = $oApiSocial->getSocialById($oSocial->IdSocial, $oSocial->TypeStr);
             if ($oSocialOld) {
                 if ($oInviteAccount && $oInviteAccount->IdAccount === $oSocialOld->IdAccount || !$oInviteAccount) {
                     if (!$oSocialOld->Disabled && $oSocialOld->issetScope('auth')) {
                         $oSocialOld->setScope('auth');
                         $oSocial->Scopes = $oSocialOld->Scopes;
                         $oApiSocial->updateSocial($oSocial);
                         $oInviteAccount = $oApiUsers->getAccountById($oSocialOld->IdAccount);
                     } else {
                         $bResult = false;
                         $sError = '?error=es-002';
                         if (!empty($mResult['email'])) {
                             $sError = $sError . '&email=' . $mResult['email'];
                         } else {
                             $sError = $sError . '&service=' . $mResult['type'];
                         }
                     }
                 } else {
                     $oInviteAccount = null;
                     $bResult = false;
                     $sError = '?error=es-003';
                 }
             } else {
                 $oInviteAccount = $oApiUsers->getAccountByEmail($mResult['email']);
                 if ($oInviteAccount) {
                     $oSocial->IdAccount = $oInviteAccount->IdAccount;
                     $oSocial->setScopes($mResult['scopes']);
                     $oApiSocial->createSocial($oSocial);
                 } else {
                     $sError = '?error=es-002';
                     if (!empty($mResult['email'])) {
                         $sError = $sError . '&email=' . $mResult['email'];
                     } else {
                         $sError = $sError . '&service=' . $mResult['type'];
                     }
                 }
             }
             if ($oInviteAccount) {
                 $oApiIntegrator = \CApi::Manager('integrator');
                 $oApiIntegrator->setAccountAsLoggedIn($oInviteAccount, true);
                 $oApiUsers->updateAccountLastLoginAndCount($oInviteAccount->IdUser);
             }
             \CApi::Location2('./' . $sError);
         } else {
             $oInviteAccount = \api_Utils::GetDefaultAccount();
             if ($oInviteAccount) {
                 $bResult = false;
                 $oSocial->IdAccount = $oInviteAccount->IdAccount;
                 $oSocialOld = $oApiSocial->getSocialById($oSocial->IdSocial, $oSocial->TypeStr);
                 if ($oSocialOld) {
                     if ($oSocialOld->IdAccount === $oSocial->IdAccount) {
                         if (in_array('null', $mResult['scopes']) || count($mResult['scopes']) === 0) {
                             $bResult = $oSocial->deleteSocial($oInviteAccount->IdAccount, $oSocial->TypeStr);
                         } else {
                             $oSocial->setScopes($mResult['scopes']);
                             $bResult = $oApiSocial->updateSocial($oSocial);
                         }
                     } else {
                         $bResult = false;
                         $oPlugin = \CApi::Plugin()->GetPluginByName('external-services');
                         if ($oPlugin) {
                             $sErrorMessage = $oPlugin->I18N('PLUGIN_EXTERNAL_SERVICES/INFO_ACCOUNT_ALREADY_ASSIGNED', $oInviteAccount);
                         }
                     }
                 } else {
                     if (!in_array('null', $mResult['scopes']) && count($mResult['scopes']) > 0) {
//.........这里部分代码省略.........
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:101,代码来源:index.php


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