• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CSocServAuthDB类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getStorageTokens

 protected function getStorageTokens()
 {
     $accessToken = '';
     if ($this->userId > 0) {
         $dbSocservUser = CSocServAuthDB::GetList(array(), array('USER_ID' => $this->userId, "EXTERNAL_AUTH_ID" => static::SERVICE_ID), false, false, array("USER_ID", "XML_ID", "OATOKEN", "OATOKEN_EXPIRES", "REFRESH_TOKEN"));
         $accessToken = $dbSocservUser->Fetch();
     }
     return $accessToken;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:9,代码来源:oauthtransport.php


示例2: getStorageToken

 public function getStorageToken()
 {
     $accessToken = null;
     $userId = intval($this->userId);
     if ($userId > 0) {
         $dbSocservUser = CSocServAuthDB::GetList(array(), array('USER_ID' => $userId, "EXTERNAL_AUTH_ID" => static::ID), false, false, array("OATOKEN", "REFRESH_TOKEN", "OATOKEN_EXPIRES"));
         if ($arOauth = $dbSocservUser->Fetch()) {
             $accessToken = $arOauth["OATOKEN"];
         }
     }
     return $accessToken;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:12,代码来源:yandex.php


示例3: saveDataDB

 public function saveDataDB()
 {
     global $USER;
     $dbSocUser = CSocServAuthDB::GetList(array(), array('XML_ID' => $this->appID, 'PERSONAL_WWW' => $this->portalURI, 'EXTERNAL_AUTH_ID' => "Bitrix24OAuth"), false, false, array("ID"));
     if ($USER->IsAuthorized()) {
         $arFields = array('PERSONAL_WWW' => $this->portalURI, 'XML_ID' => $this->appID, 'EXTERNAL_AUTH_ID' => static::SERVICE_ID, 'USER_ID' => $USER->GetID(), 'OATOKEN' => $this->access_token, 'OATOKEN_EXPIRES' => $this->accessTokenExpires, 'OASECRET' => $this->getSignatureKey(), 'LOGIN' => $this->appID);
         if ($this->refresh_token != '') {
             $arFields['REFRESH_TOKEN'] = $this->refresh_token;
         }
         if ($arUser = $dbSocUser->Fetch()) {
             return CSocServAuthDB::Update($arUser["ID"], $arFields);
         } else {
             return CSocServAuthDB::Add($arFields);
         }
     }
     return true;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:17,代码来源:bitrix24.php


示例4: getNewAccessToken

	public function getNewAccessToken($refreshToken = false, $userId = 0, $save = false)
	{
		if($this->appID == false || $this->appSecret == false)
			return false;

		if($refreshToken == false)
			$refreshToken = $this->refresh_token;

		$result = CHTTP::sPostHeader(self::TOKEN_URL, array(
			"refresh_token"=>$refreshToken,
			"client_id"=>$this->appID,
			"client_secret"=>$this->appSecret,
			"grant_type"=>"refresh_token",
		), array(), $this->httpTimeout);

		$this->arResult = CUtil::JsObjectToPhp($result);

		if(isset($this->arResult["access_token"]) && $this->arResult["access_token"] <> '')
		{
			$this->access_token = $this->arResult["access_token"];
			$this->accessTokenExpires = $this->arResult["expires_in"] + time();
			if($save && intval($userId) > 0)
			{
				$dbSocservUser = CSocServAuthDB::GetList(array(), array('USER_ID' => intval($userId), "EXTERNAL_AUTH_ID" => "GoogleOAuth"), false, false, array("ID"));
				if($arOauth = $dbSocservUser->Fetch())
					CSocServAuthDB::Update($arOauth["ID"], array("OATOKEN" => $this->access_token,"OATOKEN_EXPIRES" => $this->accessTokenExpires));
			}
			return true;
		}
		return false;
	}
开发者ID:ASDAFF,项目名称:open_bx,代码行数:31,代码来源:google.php


示例5: RefreshToken

 private function RefreshToken($socServUserId)
 {
     $result = CHTTP::sPostHeader(self::TOKEN_URL, array("refresh_token" => $this->refresh_token, "client_id" => $this->appID, "client_secret" => $this->appSecret, "grant_type" => "refresh_token"), array(), $this->httpTimeout);
     $arResult = CUtil::JsObjectToPhp($result);
     if (isset($arResult["access_token"]) && $arResult["access_token"] != '') {
         $this->access_token = $arResult["access_token"];
         CSocServAuthDB::Update($socServUserId, array("OATOKEN" => $arResult["access_token"]));
         return true;
     }
     return false;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:11,代码来源:odnoklassniki.php


示例6: AuthorizeUser

 public function AuthorizeUser($arFields)
 {
     if (!isset($arFields['XML_ID']) || $arFields['XML_ID'] == '') {
         return false;
     }
     if (!isset($arFields['EXTERNAL_AUTH_ID']) || $arFields['EXTERNAL_AUTH_ID'] == '') {
         return false;
     }
     $errorCode = 1;
     if ($GLOBALS["USER"]->IsAuthorized() && $GLOBALS["USER"]->GetID()) {
         $id = CSocServAuthDB::Add($arFields);
         if ($id && $_SESSION["OAUTH_DATA"] && is_array($_SESSION["OAUTH_DATA"])) {
             CSocServAuthDB::Update($id, $_SESSION["OAUTH_DATA"]);
             unset($_SESSION["OAUTH_DATA"]);
         }
     } else {
         $dbSocUser = CSocServAuthDB::GetList(array(), array('XML_ID' => $arFields['XML_ID'], 'EXTERNAL_AUTH_ID' => $arFields['EXTERNAL_AUTH_ID']), false, false, array("USER_ID", "ACTIVE"));
         $dbUsersOld = $GLOBALS["USER"]->GetList($by, $ord, array('XML_ID' => $arFields['XML_ID'], 'EXTERNAL_AUTH_ID' => $arFields['EXTERNAL_AUTH_ID'], 'ACTIVE' => 'Y'), array('NAV_PARAMS' => array("nTopCount" => "1")));
         $dbUsersNew = $GLOBALS["USER"]->GetList($by, $ord, array('XML_ID' => $arFields['XML_ID'], 'EXTERNAL_AUTH_ID' => 'socservices', 'ACTIVE' => 'Y'), array('NAV_PARAMS' => array("nTopCount" => "1")));
         if ($arUser = $dbSocUser->Fetch()) {
             if ($arUser["ACTIVE"] === 'Y') {
                 $USER_ID = $arUser["USER_ID"];
             }
         } elseif ($arUser = $dbUsersOld->Fetch()) {
             $USER_ID = $arUser["ID"];
         } elseif ($arUser = $dbUsersNew->Fetch()) {
             $USER_ID = $arUser["ID"];
         } elseif (COption::GetOptionString("main", "new_user_registration", "N") == "Y") {
             $arFields['PASSWORD'] = randString(30);
             //not necessary but...
             $arFields['LID'] = SITE_ID;
             $def_group = COption::GetOptionString('main', 'new_user_registration_def_group', '');
             if ($def_group != '') {
                 $arFields['GROUP_ID'] = explode(',', $def_group);
             }
             $arFieldsUser = $arFields;
             $arFieldsUser["EXTERNAL_AUTH_ID"] = "socservices";
             if (!($USER_ID = $GLOBALS["USER"]->Add($arFieldsUser))) {
                 return false;
             }
             $arFields['CAN_DELETE'] = 'N';
             $arFields['USER_ID'] = $USER_ID;
             $id = CSocServAuthDB::Add($arFields);
             if ($id && $_SESSION["OAUTH_DATA"] && is_array($_SESSION["OAUTH_DATA"])) {
                 CSocServAuth::Update($id, $_SESSION["OAUTH_DATA"]);
                 unset($_SESSION["OAUTH_DATA"]);
             }
             unset($arFields['CAN_DELETE']);
         } elseif (COption::GetOptionString("main", "new_user_registration", "N") == "N") {
             $errorCode = 2;
         }
         if (isset($USER_ID) && $USER_ID > 0) {
             $GLOBALS["USER"]->Authorize($USER_ID);
         } else {
             return $errorCode;
         }
         //it can be redirect after authorization, so no spreading. Store cookies in the session for next hit
         $GLOBALS['APPLICATION']->StoreCookies();
     }
     return true;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:61,代码来源:authmanager.php


示例7: getNewAccessToken

 public function getNewAccessToken($refreshToken, $userId = 0, $save = false)
 {
     if ($this->appID == false || $this->appSecret == false) {
         return false;
     }
     $httpClient = new \Bitrix\Main\Web\HttpClient();
     $result = $httpClient->post(static::TOKEN_URL, array("refresh_token" => $refreshToken, "client_id" => $this->appID, "client_secret" => $this->appSecret, "grant_type" => "refresh_token"));
     $arResult = \Bitrix\Main\Web\Json::decode($result);
     if (isset($arResult["access_token"]) && $arResult["access_token"] != '') {
         $this->access_token = $arResult["access_token"];
         $this->accessTokenExpires = $arResult["expires_in"];
         if ($save && intval($userId) > 0) {
             $dbSocservUser = CSocServAuthDB::GetList(array(), array('USER_ID' => intval($userId), "EXTERNAL_AUTH_ID" => static::SERVICE_ID), false, false, array("ID"));
             if ($arOauth = $dbSocservUser->Fetch()) {
                 CSocServAuthDB::Update($arOauth["ID"], array("OATOKEN" => $this->access_token, "OATOKEN_EXPIRES" => time() + $this->accessTokenExpires));
             }
         }
         return true;
     }
     return false;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:21,代码来源:office365.php


示例8: deleteStorageTokens

 protected function deleteStorageTokens()
 {
     global $USER;
     if (is_object($USER) && $USER->IsAuthorized()) {
         $dbSocservUser = CSocServAuthDB::GetList(array(), array('USER_ID' => $USER->GetID(), "EXTERNAL_AUTH_ID" => static::SERVICE_ID), false, false, array("ID"));
         while ($accessToken = $dbSocservUser->Fetch()) {
             CSocServAuthDB::Delete($accessToken['ID']);
         }
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:10,代码来源:oauthtransport.php


示例9: GetUserPerms

 private function GetUserPerms($userXmlId)
 {
     $arUserPermis = array();
     $dbSocUser = CSocServAuthDB::GetList(array(), array('EXTERNAL_AUTH_ID' => 'Twitter', 'XML_ID' => $userXmlId), false, false, array("PERMISSIONS"));
     while ($arSocUser = $dbSocUser->Fetch()) {
         $arUserPermis = unserialize($arSocUser["PERMISSIONS"]);
         if (is_array($arUserPermis)) {
             foreach ($arUserPermis as $key => $value) {
                 if ($value == "UA") {
                     $arUserPermis[$key] = "G2";
                 }
             }
         }
     }
     if (!empty($arUserPermis)) {
         return $arUserPermis;
     } else {
         return array("UA" => array("UA"));
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:20,代码来源:twitter.php


示例10: CSocServGoogleOAuth

	CWebDavExtLinks::GetExtLink($arParams, $o);
}

if(!empty($_REQUEST['editInGoogle']))
{
	CUtil::JSPostUnescape();
	CWebDavExtLinks::CheckSessID();
	CWebDavExtLinks::CheckRights($ob);

	CModule::IncludeModule('socialservices');
	$socGoogleOAuth = new CSocServGoogleOAuth();
	$googleOAuth = CUtil::JSEscape($socGoogleOAuth->GetFormHtml(array('GET_URL' => true)));

	$oAuthManager = new CSocServAuthManager();
	$arServices = $oAuthManager->GetActiveAuthServices(array());//check active google oauth service
	$dbSocservUser = CSocServAuthDB::GetList(array(), array('EXTERNAL_AUTH_ID' => 'GoogleOAuth', 'USER_ID' => $USER->GetId()));
	$row = $dbSocservUser->Fetch();
	if(!$row || empty($row['OATOKEN']))
	{
		$APPLICATION->RestartBuffer();
		echo <<<HTML
<script type="text/javascript">
	window.location.href = "{$googleOAuth}";
</script>
HTML;
	}
	else
	{
		//todo drive edit
		//require_once $_SERVER['DOCUMENT_ROOT'].'/'.BX_ROOT.'/modules/drive/worker.php';
		$appID = trim(CSocServGoogleOAuth::GetOption("google_appid"));
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:31,代码来源:webdav.php


示例11: AuthorizeUser

 public function AuthorizeUser($arFields)
 {
     global $USER, $APPLICATION;
     if (!isset($arFields['XML_ID']) || $arFields['XML_ID'] == '') {
         return false;
     }
     if (!isset($arFields['EXTERNAL_AUTH_ID']) || $arFields['EXTERNAL_AUTH_ID'] == '') {
         return false;
     }
     $arOAuthKeys = array();
     if (isset($arFields["OATOKEN"])) {
         $arOAuthKeys["OATOKEN"] = $arFields["OATOKEN"];
     }
     if (isset($arFields["REFRESH_TOKEN"]) && $arFields["REFRESH_TOKEN"] !== '') {
         $arOAuthKeys["REFRESH_TOKEN"] = $arFields["REFRESH_TOKEN"];
     }
     if (isset($arFields["OATOKEN_EXPIRES"])) {
         $arOAuthKeys["OATOKEN_EXPIRES"] = $arFields["OATOKEN_EXPIRES"];
     }
     $errorCode = SOCSERV_AUTHORISATION_ERROR;
     $dbSocUser = CSocServAuthDB::GetList(array(), array('XML_ID' => $arFields['XML_ID'], 'EXTERNAL_AUTH_ID' => $arFields['EXTERNAL_AUTH_ID']), false, false, array("ID", "USER_ID", "ACTIVE"));
     $arUser = $dbSocUser->Fetch();
     if ($USER->IsAuthorized()) {
         if (!self::isSplitDenied()) {
             if (!$arUser) {
                 $id = CSocServAuthDB::Add($arFields);
             } else {
                 $id = $arUser['ID'];
                 // socservice link split
                 if ($arUser['USER_ID'] != $USER->GetID()) {
                     $dbRes = CSocServAuthDB::GetList(array(), array('USER_ID' => $USER->GetID(), 'EXTERNAL_AUTH_ID' => $arFields['EXTERNAL_AUTH_ID']), false, false, array("ID"));
                     if ($dbRes->Fetch()) {
                         return SOCSERV_AUTHORISATION_ERROR;
                     } else {
                         $arOAuthKeys['USER_ID'] = $USER->GetID();
                         $arOAuthKeys['CAN_DELETE'] = 'Y';
                     }
                 }
             }
             if ($_SESSION["OAUTH_DATA"] && is_array($_SESSION["OAUTH_DATA"])) {
                 $arOAuthKeys = array_merge($arOAuthKeys, $_SESSION['OAUTH_DATA']);
                 unset($_SESSION["OAUTH_DATA"]);
             }
             CSocServAuthDB::Update($id, $arOAuthKeys);
         } else {
             return SOCSERV_REGISTRATION_DENY;
         }
     } else {
         $entryId = 0;
         $USER_ID = 0;
         if ($arUser) {
             $entryId = $arUser['ID'];
             if ($arUser["ACTIVE"] === 'Y') {
                 $USER_ID = $arUser["USER_ID"];
             }
         } else {
             // check for user with old socialservices linking system (socservice ID in user's EXTERNAL_AUTH_ID)
             $dbUsersOld = CUser::GetList($by = 'ID', $ord = 'ASC', array('XML_ID' => $arFields['XML_ID'], 'EXTERNAL_AUTH_ID' => $arFields['EXTERNAL_AUTH_ID'], 'ACTIVE' => 'Y'), array('NAV_PARAMS' => array("nTopCount" => "1")));
             $arUser = $dbUsersOld->Fetch();
             if ($arUser) {
                 $USER_ID = $arUser["ID"];
             } else {
                 // theoretically possible situation with abandoned external user w/o b_socialservices_user entry
                 $dbUsersNew = CUser::GetList($by = 'ID', $ord = 'ASC', array('XML_ID' => $arFields['XML_ID'], 'EXTERNAL_AUTH_ID' => 'socservices', 'ACTIVE' => 'Y'), array('NAV_PARAMS' => array("nTopCount" => "1")));
                 $arUser = $dbUsersNew->Fetch();
                 if ($arUser) {
                     $USER_ID = $arUser["ID"];
                 } elseif (COption::GetOptionString("main", "new_user_registration", "N") == "Y" && COption::GetOptionString("socialservices", "allow_registration", "Y") == "Y") {
                     $arFields['PASSWORD'] = randString(30);
                     //not necessary but...
                     $arFields['LID'] = SITE_ID;
                     $def_group = COption::GetOptionString('main', 'new_user_registration_def_group', '');
                     if ($def_group != '') {
                         $arFields['GROUP_ID'] = explode(',', $def_group);
                     }
                     if (!empty($arFields['GROUP_ID']) && self::isAuthDenied($arFields['GROUP_ID'])) {
                         $errorCode = SOCSERV_REGISTRATION_DENY;
                     } else {
                         $arFieldsUser = $arFields;
                         $arFieldsUser["EXTERNAL_AUTH_ID"] = "socservices";
                         if (isset($arFieldsUser['PERSONAL_PHOTO']) && is_array($arFieldsUser['PERSONAL_PHOTO'])) {
                             $res = CFile::CheckImageFile($arFieldsUser["PERSONAL_PHOTO"]);
                             if ($res != '') {
                                 unset($arFieldsUser['PERSONAL_PHOTO']);
                             }
                         }
                         $USER_ID = $USER->Add($arFieldsUser);
                         if ($USER_ID <= 0) {
                             $errorCode = SOCSERV_AUTHORISATION_ERROR;
                         }
                     }
                 } elseif (COption::GetOptionString("main", "new_user_registration", "N") == "N") {
                     $errorCode = SOCSERV_REGISTRATION_DENY;
                 }
                 $arFields['CAN_DELETE'] = 'N';
             }
         }
         if (isset($_SESSION["OAUTH_DATA"]) && is_array($_SESSION["OAUTH_DATA"])) {
             foreach ($_SESSION['OAUTH_DATA'] as $key => $value) {
                 $arFields[$key] = $value;
//.........这里部分代码省略.........
开发者ID:Satariall,项目名称:izurit,代码行数:101,代码来源:authmanager.php


示例12: saveDataDB

	private function saveDataDB()
	{
		$dbSocUser = CSocServAuthDB::GetList(array(), array('XML_ID' => $this->appID, 'PERSONAL_WWW' => $this->portalURI, 'EXTERNAL_AUTH_ID' => "Bitrix24OAuth"), false, false, array("ID"));

		if($GLOBALS["USER"]->IsAuthorized() && $GLOBALS["USER"]->GetID())
		{
			$arFields = array(
				'PERSONAL_WWW' => $this->portalURI,
				'XML_ID' => $this->appID,
				'EXTERNAL_AUTH_ID' => "Bitrix24OAuth",
				'USER_ID' => $GLOBALS["USER"]->GetID(),
				'OATOKEN' => $this->access_token,
				'OATOKEN_EXPIRES' => $this->accessTokenExpires + time(),
				'LOGIN' => $this->appID,
			);

			if($this->refresh_token <> '')
				$arFields['REFRESH_TOKEN'] = $this->refresh_token;

			if($arUser = $dbSocUser->Fetch())
			{
				return CSocServAuthDB::Update($arUser["ID"], $arFields);
			}
			else
			{
				return CSocServAuthDB::Add($arFields);
			}
		}
		return true;
	}
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:30,代码来源:bitrix24.php


示例13: getNewAccessToken

 public function getNewAccessToken($refreshToken = false, $userId = 0, $save = false, $scope = array())
 {
     if ($this->appID == false || $this->appSecret == false) {
         return false;
     }
     if ($refreshToken == false) {
         $refreshToken = $this->refresh_token;
     }
     $http = new HttpClient(array('socketTimeout' => $this->httpTimeout));
     $result = $http->post(static::TOKEN_URL, array('client_id' => $this->appID, 'client_secret' => $this->appSecret, 'refresh_token' => $refreshToken, 'grant_type' => 'refresh_token'));
     $arResult = Json::decode($result);
     if (isset($arResult["access_token"]) && $arResult["access_token"] != '') {
         $this->access_token = $arResult["access_token"];
         $this->accessTokenExpires = time() + $arResult["expires_in"];
         $this->refresh_token = $arResult["refresh_token"];
         if ($save && intval($userId) > 0) {
             $dbSocservUser = CSocServAuthDB::GetList(array(), array("USER_ID" => intval($userId), "EXTERNAL_AUTH_ID" => CSocServBoxAuth::ID), false, false, array("ID"));
             $arOauth = $dbSocservUser->Fetch();
             if ($arOauth) {
                 CSocServAuthDB::Update($arOauth["ID"], array("OATOKEN" => $this->access_token, "OATOKEN_EXPIRES" => $this->accessTokenExpires, "REFRESH_TOKEN" => $this->refresh_token));
             }
         }
         return true;
     }
     return false;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:26,代码来源:box.php


示例14: CheckFields

 protected function CheckFields($action, &$arFields)
 {
     global $USER;
     if ($action === 'ADD') {
         if (isset($arFields["EXTERNAL_AUTH_ID"]) && strlen($arFields["EXTERNAL_AUTH_ID"]) <= 0) {
             return false;
         }
         if (isset($arFields["SITE_ID"]) && strlen($arFields["SITE_ID"]) <= 0) {
             $arFields["SITE_ID"] = SITE_ID;
         }
         if (!isset($arFields["USER_ID"])) {
             $arFields["USER_ID"] = $USER->GetID();
         }
         $dbCheck = CSocServAuthDB::GetList(array(), array("USER_ID" => $arFields["USER_ID"], "EXTERNAL_AUTH_ID" => $arFields["EXTERNAL_AUTH_ID"]), false, false, array("ID"));
         if ($dbCheck->Fetch()) {
             return false;
         }
     }
     if (is_set($arFields, "PERSONAL_PHOTO")) {
         $res = CFile::CheckImageFile($arFields["PERSONAL_PHOTO"]);
         if (strlen($res) > 0) {
             unset($arFields["PERSONAL_PHOTO"]);
         } else {
             $arFields["PERSONAL_PHOTO"]["MODULE_ID"] = "socialservices";
             CFile::SaveForDB($arFields, "PERSONAL_PHOTO", "socialservices");
         }
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:29,代码来源:authmanager.php


示例15: getStorageTokens

 private function getStorageTokens()
 {
     global $USER;
     $accessToken = '';
     if (is_object($USER) && $USER->IsAuthorized()) {
         $dbSocservUser = CSocServAuthDB::GetList(array(), array('USER_ID' => $USER->GetID(), "EXTERNAL_AUTH_ID" => CSocServBitrix24Net::ID), false, false, array("USER_ID", "OATOKEN", "OATOKEN_EXPIRES", "REFRESH_TOKEN"));
         $accessToken = $dbSocservUser->Fetch();
     }
     return $accessToken;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:10,代码来源:bitrix24net.php


示例16: foreach

}
if (is_array($arResult["DB_SOCSERV_USER"])) {
    foreach ($arResult["DB_SOCSERV_USER"] as $key => $value) {
        if ($value["EXTERNAL_AUTH_ID"] == 'Twitter') {
            $arResult["DB_SOCSERV_USER"][$twitNum] = $arResult["DB_SOCSERV_USER"][$key];
            unset($arResult["DB_SOCSERV_USER"][$key]);
            $twitNum++;
        }
    }
}
$arParamsToDelete = array("openid_assoc_handle", "openid_identity", "openid_sreg_email", "openid_sreg_fullname", "openid_sreg_gender", "openid_mode", "openid_op_endpoint", "openid_response_nonce", "openid_return_to", "openid_signed", "openid_sig", "current_fieldset");
$add = CModule::IncludeModule("socialnetwork") && $_REQUEST["auth_service_id"] != '' && $componentTemplate == 'twitpost' ? "current_fieldset=SOCSERV" : "";
if ($_SERVER["REQUEST_METHOD"] == "GET" && $_REQUEST["action"] == "delete" && isset($_REQUEST["user_id"]) && intval($_REQUEST["user_id"] > 0) && check_bitrix_sessid()) {
    $userId = intval($_REQUEST["user_id"]);
    if (in_array($userId, $arResult["ALLOW_DELETE_ID"])) {
        if (!CSocServAuthDB::Delete($userId)) {
            $_SESSION["LAST_ERROR"] = GetMessage("DELETE_ERROR");
        }
    }
    $backurl = '';
    if ($arResult['BACKURL'] != '') {
        $backurl = $arResult['BACKURL'];
        if ($componentTemplate == 'twitpost') {
            $backurl .= (strpos($arResult['BACKURL'], '?') > 0 ? "&" : "?") . "current_fieldset=SOCSERV";
        }
    } else {
        $backurl = $APPLICATION->GetCurPageParam($componentTemplate == 'twitpost' ? "current_fieldset=SOCSERV" : "", array("sessid", "user_id", "action"));
    }
    LocalRedirect($backurl);
}
if ($componentTemplate == 'twitpost') {
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php


示例17: Authorize

 public function Authorize()
 {
     global $APPLICATION, $USER;
     $errorCode = 1;
     if ($arOpenID = $this->Validate()) {
         $arFields = array('EXTERNAL_AUTH_ID' => 'OPENID#' . $arOpenID['server'], 'XML_ID' => $arOpenID['identity'], 'PASSWORD' => randString(30), 'LID' => SITE_ID, "PERSONAL_WWW" => $arOpenID['identity']);
         if (array_key_exists('openid_sreg_email', $_GET)) {
             $arFields['EMAIL'] = $_GET['openid_sreg_email'];
         }
         if (array_key_exists('openid_sreg_gender', $_GET) && ($_GET['openid_sreg_gender'] == 'M' || $_GET['openid_sreg_gender'] == 'F')) {
             $arFields['PERSONAL_GENDER'] = $_GET['openid_sreg_gender'];
         }
         if (array_key_exists('openid_sreg_fullname', $_GET)) {
             $fullname = defined("BX_UTF") ? $_GET['openid_sreg_fullname'] : CharsetConverter::ConvertCharset($_GET['openid_sreg_fullname'], 'UTF-8', LANG_CHARSET);
             $fullname = trim($fullname);
             if (($pos = strpos($fullname, ' ')) !== false) {
                 $arFields['NAME'] = substr($fullname, 0, $pos);
                 $arFields['LAST_NAME'] = substr($fullname, $pos + 1);
             } else {
                 $arFields['NAME'] = $fullname;
             }
         }
         if (array_key_exists('openid_sreg_postcode', $_GET)) {
             $arFields['PERSONAL_ZIP'] = $_GET['openid_sreg_postcode'];
         }
         if (array_key_exists('openid_sreg_timezone', $_GET)) {
             $arFields['TIME_ZONE'] = $_GET['openid_sreg_timezone'];
         }
         if (array_key_exists('openid_sreg_country', $_GET)) {
             $arFields['PERSONAL_COUNTRY'] = GetCountryIdByCode($_GET['openid_sreg_country']);
         }
         if (array_key_exists('openid_sreg_dob', $_GET)) {
             $arFields['PERSONAL_BIRTHDAY'] = CDatabase::FormatDate($_GET['openid_sreg_dob'], "YYYY-MM-DD", FORMAT_DATE);
         }
         if (array_key_exists('BX_OPENID_IDENTITY', $_SESSION)) {
             $arFields['LOGIN'] = $_SESSION['BX_OPENID_IDENTITY'];
         } else {
             $arFields['LOGIN'] = $arOpenID['identity'];
         }
         $arFields['LOGIN'] = preg_replace("#^(http://|https://)#i", "", $arFields['LOGIN']);
         $USER_ID = 0;
         if ($GLOBALS["USER"]->IsAuthorized() && $GLOBALS["USER"]->GetID()) {
             if (!CSocServAuth::isSplitDenied()) {
                 $arFields['USER_ID'] = $GLOBALS["USER"]->GetID();
                 CSocServAuthDB::Add($arFields);
                 self::CleanParam();
             } else {
                 $errorCode = SOCSERV_REGISTRATION_DENY;
             }
         } else {
             $dbUsersOld = $GLOBALS["USER"]->GetList($by, $ord, array('XML_ID' => $arFields['XML_ID'], 'EXTERNAL_AUTH_ID' => $arFields['EXTERNAL_AUTH_ID'], 'ACTIVE' => 'Y'), array('NAV_PARAMS' => array("nTopCount" => "1")));
             $dbUsersNew = $GLOBALS["USER"]->GetList($by, $ord, array('XML_ID' => $arFields['XML_ID'], 'EXTERNAL_AUTH_ID' => 'socservices', 'ACTIVE' => 'Y'), array('NAV_PARAMS' => array("nTopCount" => "1")));
             $dbSocUser = CSocServAuthDB::GetList(array(), array('XML_ID' => $arFields['XML_ID'], 'EXTERNAL_AUTH_ID' => $arFields['EXTERNAL_AUTH_ID']), false, false, array("USER_ID", "ACTIVE"));
             if ($arUser = $dbSocUser->Fetch()) {
                 if ($arUser["ACTIVE"] === 'Y') {
                     $USER_ID = $arUser["USER_ID"];
                 }
             } elseif ($arUser = $dbUsersOld->Fetch()) {
                 $USER_ID = $arUser['ID'];
             } elseif ($arUser = $dbUsersNew->Fetch()) {
                 $USER_ID = $arUser["ID"];
             } elseif (COption::GetOptionString("main", "new_user_registration", "N") == "Y") {
                 $def_group = COption::GetOptionString('main', 'new_user_registration_def_group', '');
                 if ($def_group != '') {
                     $arFields['GROUP_ID'] = explode(',', $def_group);
                 }
                 if (!empty($arFields['GROUP_ID']) && CSocServAuth::isAuthDenied($arFields['GROUP_ID'])) {
                     $errorCode = SOCSERV_REGISTRATION_DENY;
                 } else {
                     foreach (GetModuleEvents("main", "OnBeforeOpenIDUserAdd", true) as $arEvent) {
                         ExecuteModuleEventEx($arEvent, array($arFields));
                     }
                     $arFieldsUser = $arFields;
                     $arFieldsUser["EXTERNAL_AUTH_ID"] = "socservices";
                     if (!($USER_ID = $GLOBALS["USER"]->Add($arFieldsUser))) {
                         return false;
                     }
                     $arFields['CAN_DELETE'] = 'N';
                     $arFields['USER_ID'] = $USER_ID;
                     CSocServAuthDB::Add($arFields);
                     unset($arFields['CAN_DELETE']);
                 }
             } elseif (COption::GetOptionString("main", "new_user_registration", "N") == "N") {
                 $errorCode = 2;
             }
             if (intval($USER_ID) > 0) {
                 $arGroups = $USER->GetUserGroup($USER_ID);
                 if (CSocServAuth::isAuthDenied($arGroups)) {
                     $errorCode = SOCSERV_AUTHORISATION_ERROR;
                 } else {
                     $USER->AuthorizeWithOtp($USER_ID);
                     $arKillParams = array("auth_service_id", "check_key");
                     foreach (array_keys($_GET) as $k) {
                         if (strpos($k, 'openid_') === 0) {
                             $arKillParams[] = $k;
                         }
                     }
                     $redirect_url = $APPLICATION->GetCurPageParam('', $arKillParams, false);
                     foreach (GetModuleEvents("main", "OnBeforeOpenIDAuthFinalRedirect", true) as $arEvent) {
                         ExecuteModuleEventEx($arEvent, array($redirect_url, $USER_ID, $arFields));
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:openidclient.php


示例18: getStorageTokens

	private function getStorageTokens()
	{
		global $USER;

		$accessToken = '';
		if(is_object($USER))
		{
			$dbSocservUser = CSocServAuthDB::GetList(array(), array('USER_ID' => $USER->GetID(), "EXTERNAL_AUTH_ID" => CSocServYandexAuth::ID), false, false, array("OATOKEN", "REFRESH_TOKEN"));
			if($arOauth = $dbSocservUser->Fetch())
			{
				$accessToken = $arOauth["OATOKEN"];
			}
		}
		return $accessToken;
	}
开发者ID:ASDAFF,项目名称:open_bx,代码行数:15,代码来源:yandex.php


示例19: SetOauthKeys

 private function SetOauthKeys($socServUserId)
 {
     $dbSocservUser = CSocServAuthDB::GetList(array(), array('ID' => $socServUserId), false, false, array("OATOKEN", "XML_ID"));
     while ($arOauth = $dbSocservUser->Fetch()) {
         $this->access_token = $arOauth["OATOKEN"];
         $this->userId = $arOauth["XML_ID"];
     }
     if (!$this->access_token || !$this->userId) {
         return false;
     }
     return true;
 }
开发者ID:spas-viktor,项目名称:books,代码行数:12,代码来源:facebook.php


示例20: intval

                $arResult["USER_PERSONAL_PHOTO_SRC"] = $arFileTmp["src"];
            }
        }
        if (defined("BX_COMP_MANAGED_CACHE")) {
            $CACHE_MANAGER->RegisterTag("USER_CARD_" . intval($user_id / TAGGED_user_card_size));
            $CACHE_MANAGER->EndTagCache();
        }
    }
    if ($obCache->StartDataCache()) {
        $obCache->EndDataCache($arResult["USER_PERSONAL_PHOTO_SRC"]);
    }
}
// add chache here!!!
if (IsModuleInstalled('bitrix24') && COption::GetOptionString('bitrix24', 'network', 'N') == 'Y' && CModule::IncludeModule('socialservices')) {
    // also check for B24Net turned on in module settings
    $dbSocservUser = CSocServAuthDB::GetList(array(), array('USER_ID' => $user_id, "EXTERNAL_AUTH_ID" => CSocServBitrix24Net::ID), false, false, array("PERSONAL_WWW"));
    $arSocservUser = $dbSocservUser->Fetch();
    if ($arSocservUser) {
        $arResult['B24NET_WWW'] = $arSocservUser['PERSONAL_WWW'];
    }
}
//B24 helper
if (!function_exists("__getVideoStepByUrl")) {
    function __getVideoStepByUrl($videoSteps, $url)
    {
        $result = $url == "/" ? $videoSteps[0]["id"] : "other";
        foreach ($videoSteps as $step) {
            foreach ($step["patterns"] as $pattern) {
                //echo $pattern."<br>";
                if (preg_match($pattern, $url)) {
                    $result = $step["id"];
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:result_modifier.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CSocServAuthManager类代码示例发布时间:2022-05-20
下一篇:
PHP CSocNetUserToGroup类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap