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


PHP CSocServUtil::GetCurUrl方法代码示例

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


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

示例1: GetFormHtml

	static public function GetFormHtml($arParams)
	{
		$appID = trim(self::GetOption("vkontakte_appid"));
		$appSecret = trim(self::GetOption("vkontakte_appsecret"));

		$gAuth = new CVKontakteOAuthInterface($appID, $appSecret);

		if(IsModuleInstalled('bitrix24') && defined('BX24_HOST_NAME'))
		{
			$redirect_uri = self::CONTROLLER_URL."/redirect.php";
			$state = urlencode(CSocServUtil::GetCurUrl('auth_service_id='.self::ID.'&check_key='.$_SESSION["UNIQUE_KEY"]));
		}
		else
		{
			$redirect_uri = CSocServUtil::GetCurUrl('auth_service_id='.self::ID);
			$redirect_uri = CSocServUtil::ServerName().$GLOBALS['APPLICATION']->GetCurPage(true).'?auth_service_id='.self::ID;
			$state = urlencode('site_id='.SITE_ID.'&backurl='.urlencode($GLOBALS["APPLICATION"]->GetCurPageParam('check_key='.$_SESSION["UNIQUE_KEY"], array("logout", "auth_service_error", "auth_service_id", "backurl"))));
		}

		$url = $gAuth->GetAuthUrl($redirect_uri, $state);
		$phrase = ($arParams["FOR_INTRANET"]) ? GetMessage("socserv_vk_note_intranet") : GetMessage("socserv_vk_note");
		if($arParams["FOR_INTRANET"])
			return array("ON_CLICK" => 'onclick="BX.util.popup(\''.htmlspecialcharsbx(CUtil::JSEscape($url)).'\', 580, 400)"');
		return '<a href="javascript:void(0)" onclick="BX.util.popup(\''.htmlspecialcharsbx(CUtil::JSEscape($url)).'\', 580, 400)" class="bx-ss-button vkontakte-button"></a><span class="bx-spacer"></span><span>'.$phrase.'</span>';

	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:26,代码来源:vkontakte.php

示例2: Authorize

	public function Authorize()
	{
		$GLOBALS["APPLICATION"]->RestartBuffer();
		$bSuccess = false;

			if(isset($_REQUEST["code"]) && $_REQUEST["code"] <> '')
			{
				if(CSocServAuthManager::CheckUniqueKey())
				{
				$redirect_uri = CSocServUtil::GetCurUrl('auth_service_id='.self::ID, array("code"));

				$appID = self::GetOption("facebook_appid");
				$appSecret = self::GetOption("facebook_appsecret");

				$fb = new CFacebookInterface($appID, $appSecret, $_REQUEST["code"]);

				if($fb->GetAccessToken($redirect_uri) !== false)
				{
					$arFBUser = $fb->GetCurrentUser();
					if(isset($arFBUser["id"]))
					{
						$arFields = array(
							'EXTERNAL_AUTH_ID' => self::ID,
							'XML_ID' => $arFBUser["id"],
							'LOGIN' => "FB_".$arFBUser["email"],
							'EMAIL' => $arFBUser["email"],
							'NAME'=> $arFBUser["first_name"],
							'LAST_NAME'=> $arFBUser["last_name"],
						);

						if(isset($arFBUser['picture']['data']['url']) && self::CheckPhotoURI($arFBUser['picture']['data']['url']))
							if ($arPic = CFile::MakeFileArray($arFBUser['picture']['data']['url']))
								$arFields["PERSONAL_PHOTO"] = $arPic;
						if(isset($arFBUser['birthday']))
							if ($date = MakeTimeStamp($arFBUser['birthday'], "MM/DD/YYYY"))
								$arFields["PERSONAL_BIRTHDAY"] = ConvertTimeStamp($date);
						if(isset($arFBUser['gender']) && $arFBUser['gender'] != '')
						{
							if ($arFBUser['gender'] == 'male')
								$arFields["PERSONAL_GENDER"] = 'M';
							elseif ($arFBUser['gender'] == 'female')
								$arFields["PERSONAL_GENDER"] = 'F';
						}
						$arFields["PERSONAL_WWW"] = "http://www.facebook.com/".$arFBUser["id"];
						$bSuccess = $this->AuthorizeUser($arFields);
					}
				}
			}
		}
		$aRemove = array("logout", "auth_service_error", "auth_service_id", "code", "error_reason", "error", "error_description", "check_key");
		$url = $GLOBALS['APPLICATION']->GetCurPageParam(($bSuccess? '':'auth_service_id='.self::ID.'&auth_service_error=1'), $aRemove);
		echo '
<script type="text/javascript">
if(window.opener)
	window.opener.location = \''.CUtil::JSEscape($url).'\';
window.close();
</script>
';
		die();
	}
开发者ID:nProfessor,项目名称:Mytb,代码行数:60,代码来源:facebook.php

示例3: Authorize

	public function Authorize($identity=false, $var=false)
	{
		if($var === false)
			$var = 'OPENID_IDENTITY_OPENID';

		$step = COpenIDClient::GetOpenIDAuthStep($var);
		if($step > 0)
		{
			$obOpenID = new COpenIDClient();
		
			if($step == 2)
			{
				return $obOpenID->Authorize();
			}
			elseif($step == 1)
			{
				if($identity === false)
					$identity = $_REQUEST['OPENID_IDENTITY_OPENID'];
				CSocServAuthManager::SetUniqueKey();
				$return_to = CSocServUtil::GetCurUrl("auth_service_id=".urlencode($_REQUEST["auth_service_id"])."&check_key=".$_SESSION["UNIQUE_KEY"]);

				if($url = $obOpenID->GetRedirectUrl($identity, $return_to))
					LocalRedirect($url, true);
				else
					return false;
			}
		}
		return false;
	}
开发者ID:nProfessor,项目名称:Mytb,代码行数:29,代码来源:openid.php

示例4: Authorize

 public function Authorize($identity = false, $var = false)
 {
     if ($var === false) {
         $var = 'OPENID_IDENTITY_OPENID';
     }
     $step = COpenIDClient::GetOpenIDAuthStep($var);
     if ($step > 0) {
         $obOpenID = new COpenIDClient();
         if ($step == 2) {
             return $obOpenID->Authorize();
         } elseif ($step == 1) {
             if ($identity === false) {
                 $identity = $_REQUEST['OPENID_IDENTITY_OPENID'];
             }
             CSocServAuthManager::SetUniqueKey();
             $return_to = CSocServUtil::GetCurUrl("auth_service_id=" . urlencode($_REQUEST["auth_service_id"]) . "&check_key=" . $_SESSION["UNIQUE_KEY"], array("SEF_APPLICATION_CUR_PAGE_URL", "auth_service_error", "auth_service_id", "login"));
             if ($url = $obOpenID->GetRedirectUrl($identity, $return_to)) {
                 LocalRedirect($url, true);
             } else {
                 LocalRedirect(CSocServUtil::GetCurUrl("auth_service_id=" . urlencode($_REQUEST["auth_service_id"]) . "&auth_service_error=1"));
             }
             return false;
         }
     }
     return false;
 }
开发者ID:spas-viktor,项目名称:books,代码行数:26,代码来源:openid.php

示例5: Authorize

    public function Authorize()
    {
        $GLOBALS["APPLICATION"]->RestartBuffer();
        $bSuccess = 1;
        if (isset($_REQUEST["code"]) && $_REQUEST["code"] != '') {
            if (CSocServAuthManager::CheckUniqueKey()) {
                if (IsModuleInstalled('bitrix24') && defined('BX24_HOST_NAME')) {
                    $redirect_uri = self::CONTROLLER_URL . "/redirect.php?redirect_to=" . urlencode(CSocServUtil::GetCurUrl('auth_service_id=' . self::ID, array("code")));
                } else {
                    $redirect_uri = CSocServUtil::GetCurUrl('auth_service_id=' . self::ID, array("code"));
                }
                $appID = trim(self::GetOption("facebook_appid"));
                $appSecret = trim(self::GetOption("facebook_appsecret"));
                $fb = new CFacebookInterface($appID, $appSecret, $_REQUEST["code"]);
                if ($fb->GetAccessToken($redirect_uri) !== false) {
                    $arFBUser = $fb->GetCurrentUser();
                    if (is_array($arFBUser) && isset($arFBUser["id"])) {
                        $email = $arFBUser["email"] != '' ? $arFBUser["email"] : '';
                        $arFields = array('EXTERNAL_AUTH_ID' => self::ID, 'XML_ID' => $arFBUser["id"], 'LOGIN' => "FB_" . $arFBUser["id"], 'EMAIL' => $email, 'NAME' => $arFBUser["first_name"], 'LAST_NAME' => $arFBUser["last_name"]);
                        if (isset($arFBUser['picture']['data']['url']) && self::CheckPhotoURI($arFBUser['picture']['data']['url'])) {
                            if ($arPic = CFile::MakeFileArray($arFBUser['picture']['data']['url'])) {
                                $arFields["PERSONAL_PHOTO"] = $arPic;
                            }
                        }
                        if (isset($arFBUser['birthday'])) {
                            if ($date = MakeTimeStamp($arFBUser['birthday'], "MM/DD/YYYY")) {
                                $arFields["PERSONAL_BIRTHDAY"] = ConvertTimeStamp($date);
                            }
                        }
                        if (isset($arFBUser['gender']) && $arFBUser['gender'] != '') {
                            if ($arFBUser['gender'] == 'male') {
                                $arFields["PERSONAL_GENDER"] = 'M';
                            } elseif ($arFBUser['gender'] == 'female') {
                                $arFields["PERSONAL_GENDER"] = 'F';
                            }
                        }
                        $arFields["PERSONAL_WWW"] = "http://www.facebook.com/" . $arFBUser["id"];
                        if (strlen(SITE_ID) > 0) {
                            $arFields["SITE_ID"] = SITE_ID;
                        }
                        $bSuccess = $this->AuthorizeUser($arFields);
                    }
                }
            }
        }
        $aRemove = array("logout", "auth_service_error", "auth_service_id", "code", "error_reason", "error", "error_description", "check_key", "current_fieldset");
        $url = $GLOBALS['APPLICATION']->GetCurPageParam($bSuccess === true ? '' : 'auth_service_id=' . self::ID . '&auth_service_error=' . $bSuccess, $aRemove);
        if (CModule::IncludeModule("socialnetwork") && strpos($url, "current_fieldset=") === false) {
            $url = preg_match("/\\?/", $url) ? $url . "&current_fieldset=SOCSERV" : $url . "?current_fieldset=SOCSERV";
        }
        echo '
<script type="text/javascript">
if(window.opener)
	window.opener.location = \'' . CUtil::JSEscape($url) . '\';
window.close();
</script>
';
        die;
    }
开发者ID:spas-viktor,项目名称:books,代码行数:59,代码来源:facebook.php

示例6: Authorize

    public function Authorize()
    {
        $GLOBALS["APPLICATION"]->RestartBuffer();
        $bSuccess = 1;
        $appID = trim(self::GetOption("twitter_key"));
        $appSecret = trim(self::GetOption("twitter_secret"));
        if (!isset($_REQUEST["oauth_token"]) || $_REQUEST["oauth_token"] == '') {
            $tw = new CTwitterInterface($appID, $appSecret);
            $callback = CSocServUtil::GetCurUrl('auth_service_id=' . self::ID);
            //$callback = 'http://algerman.sam:6448/script.php?auth_service_id='.self::ID;
            if ($tw->GetRequestToken($callback)) {
                $tw->RedirectAuthUrl();
            }
        } elseif (CSocServAuthManager::CheckUniqueKey()) {
            $tw = new CTwitterInterface($appID, $appSecret, $_REQUEST["oauth_token"], $_REQUEST["oauth_verifier"]);
            if (($arResult = $tw->GetAccessToken()) !== false && $arResult["user_id"] != '') {
                $twUser = $tw->GetUserInfo($arResult["user_id"]);
                $first_name = $last_name = "";
                if ($twUser["name"] != '') {
                    $aName = explode(" ", $twUser["name"]);
                    $first_name = $aName[0];
                    if (isset($aName[1])) {
                        $last_name = $aName[1];
                    }
                }
                $arFields = array('EXTERNAL_AUTH_ID' => self::ID, 'XML_ID' => $arResult["user_id"], 'LOGIN' => $arResult["screen_name"], 'NAME' => $first_name, 'LAST_NAME' => $last_name);
                if (isset($twUser["profile_image_url"]) && self::CheckPhotoURI($twUser["profile_image_url"])) {
                    if ($arPic = CFile::MakeFileArray($twUser["profile_image_url"])) {
                        $arFields["PERSONAL_PHOTO"] = $arPic;
                    }
                }
                $arFields["PERSONAL_WWW"] = "https://twitter.com/" . $arResult["screen_name"];
                if (strlen(SITE_ID) > 0) {
                    $arFields["SITE_ID"] = SITE_ID;
                }
                if (COption::GetOptionString('socialservices', 'last_twit_id', '1') == 1) {
                    if (isset($twUser["status"]["id_str"])) {
                        COption::SetOptionString('socialservices', 'last_twit_id', $twUser["status"]["id_str"]);
                    }
                }
                $bSuccess = $this->AuthorizeUser($arFields);
            }
        }
        $aRemove = array("logout", "auth_service_error", "auth_service_id", "oauth_token", "oauth_verifier", "check_key", "current_fieldset");
        $url = $GLOBALS['APPLICATION']->GetCurPageParam($bSuccess === true ? '' : 'auth_service_id=' . self::ID . '&auth_service_error=' . $bSuccess, $aRemove);
        if (CModule::IncludeModule("socialnetwork")) {
            $url = preg_match("/\\?/", $url) ? $url . "&current_fieldset=SOCSERV" : $url . "?current_fieldset=SOCSERV";
        }
        echo '
<script type="text/javascript">
if(window.opener)
	window.opener.location = \'' . CUtil::JSEscape($url) . '\';
window.close();
</script>
';
        die;
    }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:57,代码来源:twitter.php

示例7: Authorize

	public function Authorize()
	{
		$GLOBALS["APPLICATION"]->RestartBuffer();
		$bSuccess = false;

		$appID = self::GetOption("twitter_key");
		$appSecret = self::GetOption("twitter_secret");

		if(!isset($_REQUEST["oauth_token"]) || $_REQUEST["oauth_token"] == '')
		{
			$tw = new CTwitterInterface($appID, $appSecret);
			$callback = CSocServUtil::GetCurUrl('auth_service_id='.self::ID);
			if($tw->GetRequestToken($callback))
				$tw->RedirectAuthUrl();
		}
		elseif(CSocServAuthManager::CheckUniqueKey())
		{
			$tw = new CTwitterInterface($appID, $appSecret, $_REQUEST["oauth_token"], $_REQUEST["oauth_verifier"]);
			if(($arResult = $tw->GetAccessToken()) !== false && $arResult["user_id"] <> '')
			{
				$twUser = $tw->GetUserInfo($arResult["user_id"]);

				$first_name = $last_name = "";
				if($twUser["name"] <> '')
				{
					$aName = explode(" ", $twUser["name"]);
					$first_name = $aName[0];
					if(isset($aName[1]))
						$last_name = $aName[1];
				}

				$arFields = array(
					'EXTERNAL_AUTH_ID' => self::ID,
					'XML_ID' => $arResult["user_id"],
					'LOGIN' => $arResult["screen_name"],
					'NAME'=> $first_name,
					'LAST_NAME'=> $last_name,
				);
				$arFields["PERSONAL_WWW"] = "https://twitter.com/".$twUser["screen_name"];

				$bSuccess = $this->AuthorizeUser($arFields);
			}
		}

		$aRemove = array("logout", "auth_service_error", "auth_service_id", "oauth_token", "oauth_verifier", "check_key");
		$url = $GLOBALS['APPLICATION']->GetCurPageParam(($bSuccess? '':'auth_service_id='.self::ID.'&auth_service_error=1'), $aRemove);
		echo '
<script type="text/javascript">
if(window.opener)
	window.opener.location = \''.CUtil::JSEscape($url).'\';
window.close();
</script>
';
		die();
	}
开发者ID:nProfessor,项目名称:Mytb,代码行数:55,代码来源:twitter.php

示例8: getUrl

	public function getUrl($mode = "page")
	{
		$redirect_uri = CSocServUtil::GetCurUrl('auth_service_id='.self::ID);

		$state =
			'site_id='.SITE_ID
			.'&backurl='.urlencode($GLOBALS["APPLICATION"]->GetCurPageParam(
				'check_key='.CSocServAuthManager::GetUniqueKey(),
				array(
					"logout", "auth_service_error", "auth_service_id", "check_key"
				)
			))
			.'&mode='.$mode;

		return $this->getEntityOAuth()->GetAuthUrl($redirect_uri, $state);
	}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:16,代码来源:bitrix24net.php

示例9: getUrl

	public function getUrl($location = 'opener', $addScope = null)
	{
		$appID = trim(self::GetOption("google_appid"));
		$appSecret = trim(self::GetOption("google_appsecret"));

		$this->entityOAuth = new CGoogleOAuthInterface($appID, $appSecret);
		if($this->user == null)
			$this->entityOAuth->setRefreshToken("skip");
		if($addScope !== null)
			$this->entityOAuth->addScope($addScope);

		if(IsModuleInstalled('bitrix24') && defined('BX24_HOST_NAME'))
		{
			$redirect_uri = self::CONTROLLER_URL."/redirect.php";
			$state = urlencode(CSocServUtil::GetCurUrl('auth_service_id='.self::ID.'&check_key='.$_SESSION["UNIQUE_KEY"].'&mode='.$location));
		}
		else
		{
			$state = 'site_id='.SITE_ID.'&backurl='.urlencode($GLOBALS["APPLICATION"]->GetCurPageParam('check_key='.$_SESSION["UNIQUE_KEY"], array("logout", "auth_service_error", "auth_service_id", "backurl"))).'&mode='.$location;
			$redirect_uri = CSocServUtil::ServerName()."/bitrix/tools/oauth/google.php";
		}

		return $this->entityOAuth->GetAuthUrl($redirect_uri, $state);
	}
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:24,代码来源:google.php

示例10: Authorize

    public function Authorize()
    {
        $GLOBALS["APPLICATION"]->RestartBuffer();
        $bSuccess = 1;
        $bProcessState = false;
        if (isset($_REQUEST["code"]) && $_REQUEST["code"] != '' && CSocServAuthManager::CheckUniqueKey()) {
            $bProcessState = true;
            $redirect_uri = CSocServUtil::GetCurUrl('auth_service_id=' . self::ID, array("code", "state", "check_key", "backurl"));
            $appID = trim(self::GetOption("mailru_id"));
            $appSecret = trim(self::GetOption("mailru_secret_key"));
            $gAuth = new CMailRuOAuthInterface($appID, $appSecret, $_REQUEST["code"]);
            if ($gAuth->GetAccessToken($redirect_uri) !== false) {
                $arMRUser = $gAuth->GetCurrentUser();
                if (is_array($arMRUser) && $arMRUser['0']['uid'] != '') {
                    $email = $first_name = $last_name = $gender = "";
                    if ($arMRUser['0']['first_name'] != '') {
                        $first_name = $arMRUser['0']['first_name'];
                    }
                    if ($arMRUser['0']['last_name'] != '') {
                        $last_name = $arMRUser['0']['last_name'];
                    }
                    if ($arMRUser['0']['email'] != '') {
                        $email = $arMRUser['0']['email'];
                    }
                    if (isset($arMRUser['0']['sex']) && $arMRUser['0']['sex'] != '') {
                        if ($arMRUser['0']['sex'] == '0') {
                            $gender = 'M';
                        } elseif ($arMRUser['0']['sex'] == '1') {
                            $gender = 'F';
                        }
                    }
                    $arFields = array('EXTERNAL_AUTH_ID' => self::ID, 'XML_ID' => $arMRUser['0']['uid'], 'LOGIN' => "MM_" . $email, 'NAME' => $first_name, 'EMAIL' => $email, 'LAST_NAME' => $last_name, 'PERSONAL_GENDER' => $gender);
                    if (isset($arMRUser['0']['birthday'])) {
                        if ($date = MakeTimeStamp($arMRUser['0']['birthday'], "DD.MM.YYYY")) {
                            $arFields["PERSONAL_BIRTHDAY"] = ConvertTimeStamp($date);
                        }
                    }
                    if (isset($arMRUser['0']['pic_190']) && self::CheckPhotoURI($arMRUser['0']['pic_190'])) {
                        if ($arPic = CFile::MakeFileArray($arMRUser['0']['pic_190'] . '?name=/' . md5($arMRUser['0']['pic_190']) . '.jpg')) {
                            $arFields["PERSONAL_PHOTO"] = $arPic;
                        }
                    }
                    $arFields["PERSONAL_WWW"] = $arMRUser['0']['link'];
                    if (strlen(SITE_ID) > 0) {
                        $arFields["SITE_ID"] = SITE_ID;
                    }
                    $bSuccess = $this->AuthorizeUser($arFields);
                }
            }
        }
        if (!$bProcessState) {
            unset($_REQUEST["state"]);
        }
        $url = $GLOBALS["APPLICATION"]->GetCurDir() == "/login/" ? "" : $GLOBALS["APPLICATION"]->GetCurDir();
        if (isset($_REQUEST["state"])) {
            $arState = array();
            parse_str($_REQUEST["state"], $arState);
            if (isset($arState['backurl'])) {
                $url = parse_url($arState['backurl'], PHP_URL_PATH);
            }
        }
        $aRemove = array("logout", "auth_service_error", "auth_service_id", "code", "error_reason", "error", "error_description", "check_key");
        if ($bSuccess !== true) {
            $url = $GLOBALS['APPLICATION']->GetCurPageParam('auth_service_id=' . self::ID . '&auth_service_error=' . $bSuccess, $aRemove);
        }
        echo '
<script type="text/javascript">
if(window.opener)
	window.opener.location = \'' . CUtil::JSEscape($url) . '\';
window.close();
</script>
';
        die;
    }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:74,代码来源:mailru.php

示例11: Authorize

    public function Authorize()
    {
        $GLOBALS["APPLICATION"]->RestartBuffer();
        $bSuccess = 1;
        if (isset($_REQUEST["code"]) && $_REQUEST["code"] != '' && CSocServAuthManager::CheckUniqueKey()) {
            if (IsModuleInstalled('bitrix24') && defined('BX24_HOST_NAME')) {
                $redirect_uri = self::CONTROLLER_URL . "/redirect.php";
            } else {
                $redirect_uri = CSocServUtil::GetCurUrl('auth_service_id=' . self::ID, array("code", "state", "backurl", "check_key"));
            }
            $appID = trim(self::GetOption("vkontakte_appid"));
            $appSecret = trim(self::GetOption("vkontakte_appsecret"));
            $gAuth = new CVKontakteOAuthInterface($appID, $appSecret, $_REQUEST["code"]);
            if ($gAuth->GetAccessToken($redirect_uri) !== false) {
                $arVkUser = $gAuth->GetCurrentUser();
                if ($arVkUser['response']['0']['uid'] != '') {
                    $first_name = $last_name = $gender = "";
                    if ($arVkUser['response']['0']['first_name'] != '') {
                        $first_name = $arVkUser['response']['0']['first_name'];
                    }
                    if ($arVkUser['response']['0']['last_name'] != '') {
                        $last_name = $arVkUser['response']['0']['last_name'];
                    }
                    if (isset($arVkUser['response']['0']['sex']) && $arVkUser['response']['0']['sex'] != '') {
                        if ($arVkUser['response']['0']['sex'] == '2') {
                            $gender = 'M';
                        } elseif ($arVkUser['response']['0']['sex'] == '1') {
                            $gender = 'F';
                        }
                    }
                    $arFields = array('EXTERNAL_AUTH_ID' => self::ID, 'XML_ID' => $arVkUser['response']['0']['uid'], 'LOGIN' => "VKuser" . $arVkUser['response']['0']['uid'], 'NAME' => $first_name, 'LAST_NAME' => $last_name, 'PERSONAL_GENDER' => $gender);
                    if (isset($arVkUser['response']['0']['photo_big']) && self::CheckPhotoURI($arVkUser['response']['0']['photo_big'])) {
                        if ($arPic = CFile::MakeFileArray($arVkUser['response']['0']['photo_big'])) {
                            $arFields["PERSONAL_PHOTO"] = $arPic;
                        }
                    }
                    if (isset($arVkUser['response']['0']['bdate'])) {
                        if ($date = MakeTimeStamp($arVkUser['response']['0']['bdate'], "DD.MM.YYYY")) {
                            $arFields["PERSONAL_BIRTHDAY"] = ConvertTimeStamp($date);
                        }
                    }
                    $arFields["PERSONAL_WWW"] = "http://vk.com/id" . $arVkUser['response']['0']['uid'];
                    if (strlen(SITE_ID) > 0) {
                        $arFields["SITE_ID"] = SITE_ID;
                    }
                    $bSuccess = $this->AuthorizeUser($arFields);
                }
            }
        }
        $url = $GLOBALS["APPLICATION"]->GetCurDir() == "/login/" ? "/auth/" : $GLOBALS["APPLICATION"]->GetCurDir();
        if (isset($_REQUEST["state"])) {
            $arState = array();
            parse_str($_REQUEST["state"], $arState);
            if (isset($arState['backurl'])) {
                $url = parse_url($arState['backurl'], PHP_URL_PATH);
            }
        }
        $aRemove = array("logout", "auth_service_error", "auth_service_id", "code", "error_reason", "error", "error_description", "check_key", "current_fieldset");
        if ($bSuccess === 2) {
            $url = preg_match("/\\?/", $url) ? $url . '&' : $url . '?';
            $url .= 'auth_service_id=' . self::ID . '&auth_service_error=' . $bSuccess;
        } elseif ($bSuccess !== true) {
            $url = isset($parseUrl) ? $parseUrl . '?auth_service_id=' . self::ID . '&auth_service_error=' . $bSuccess : $GLOBALS['APPLICATION']->GetCurPageParam('auth_service_id=' . self::ID . '&auth_service_error=' . $bSuccess, $aRemove);
        }
        if (CModule::IncludeModule("socialnetwork")) {
            $url = preg_match("/\\?/", $url) ? $url . "&current_fieldset=SOCSERV" : $url . "?current_fieldset=SOCSERV";
        }
        echo '
<script type="text/javascript">
if(window.opener)
	window.opener.location = \'' . CUtil::JSEscape($url) . '\';
window.close();
</script>
';
        die;
    }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:76,代码来源:vkontakte.php

示例12: Authorize

	public function Authorize()
	{
		$GLOBALS["APPLICATION"]->RestartBuffer();
		$bSuccess = 1;

		if((isset($_REQUEST["code"]) && $_REQUEST["code"] <> '') && CSocServAuthManager::CheckUniqueKey())
		{
			$redirect_uri = CSocServUtil::GetCurUrl('auth_service_id='.self::ID, array("code", "state", "backurl", "check_key"));
			$appID = trim(self::GetOption("vkontakte_appid"));
			$appSecret = trim(self::GetOption("vkontakte_appsecret"));

			$gAuth = new CVKontakteOAuthInterface($appID, $appSecret, $_REQUEST["code"]);
			if($gAuth->GetAccessToken($redirect_uri) !== false)
			{
				$arVkUser = $gAuth->GetCurrentUser();

				if($arVkUser['response']['0']['uid'] <> '')
				{
					$first_name = $last_name = $gender = "";
					if($arVkUser['response']['0']['first_name'] <> '')
					{
						$first_name = $arVkUser['response']['0']['first_name'];
					}
					if($arVkUser['response']['0']['last_name'] <> '')
					{
						$last_name = $arVkUser['response']['0']['last_name'];
					}

					if(isset($arVkUser['response']['0']['sex']) && $arVkUser['response']['0']['sex'] != '')
					{
						if ($arVkUser['response']['0']['sex'] == '2')
							$gender = 'M';
						elseif ($arVkUser['response']['0']['sex'] == '1')
							$gender = 'F';
					}

					$arFields = array(
						'EXTERNAL_AUTH_ID' => self::ID,
						'XML_ID' => $arVkUser['response']['0']['uid'],
						'LOGIN' => "VKuser".$arVkUser['response']['0']['uid'],
						'NAME'=> $first_name,
						'LAST_NAME'=> $last_name,
						'PERSONAL_GENDER' => $gender,
					);

					if(isset($arVkUser['response']['0']['photo_big']) && self::CheckPhotoURI($arVkUser['response']['0']['photo_big']))
						if ($arPic = CFile::MakeFileArray($arVkUser['response']['0']['photo_big']))
							$arFields["PERSONAL_PHOTO"] = $arPic;
					if(isset($arVkUser['response']['0']['bdate']))
						if ($date = MakeTimeStamp($arVkUser['response']['0']['bdate'], "DD.MM.YYYY"))
							$arFields["PERSONAL_BIRTHDAY"] = ConvertTimeStamp($date);
					$arFields["PERSONAL_WWW"] = "http://vk.com/id".$arVkUser['response']['0']['uid'];

					$bSuccess = $this->AuthorizeUser($arFields);
				}
			}
		}

		$url = ($GLOBALS["APPLICATION"]->GetCurDir() == "/login/") ? "/auth/" : $GLOBALS["APPLICATION"]->GetCurDir();

		if(isset($_REQUEST["state"]))
		{
			$arState = array();
			parse_str($_REQUEST["state"], $arState);

			if(isset($arState['backurl']))
				$url = parse_url($arState['backurl'], PHP_URL_PATH);
		}
		$aRemove = array("logout", "auth_service_error", "auth_service_id", "code", "error_reason", "error", "error_description", "check_key", "current_fieldset");
		if(isset($_REQUEST["current_fieldset"]))
			$url = $GLOBALS['APPLICATION']->GetCurPageParam(('current_fieldset='.$_REQUEST["current_fieldset"]), $aRemove);
		if($bSuccess !== true)
			$url = $GLOBALS['APPLICATION']->GetCurPageParam(('auth_service_id='.self::ID.'&auth_service_error='.$bSuccess), $aRemove);
		echo '
<script type="text/javascript">
if(window.opener)
	window.opener.location = \''.CUtil::JSEscape($url).'\';
window.close();
</script>
';
		die();
	}
开发者ID:nProfessor,项目名称:Mytb,代码行数:82,代码来源:vkontakte.php

示例13: Authorize

    public function Authorize()
    {
        $GLOBALS["APPLICATION"]->RestartBuffer();
        $bSuccess = 1;
        if (isset($_REQUEST["code"]) && $_REQUEST["code"] != '' && CSocServAuthManager::CheckUniqueKey()) {
            $redirect_uri = CSocServUtil::GetCurUrl('auth_service_id=' . self::ID, array("code", "state", "backurl", "check_key"));
            $appID = trim(self::GetOption("liveid_appid"));
            $appSecret = trim(self::GetOption("liveid_appsecret"));
            $gAuth = new CLiveIDOAuthInterface($appID, $appSecret, $_REQUEST["code"]);
            if ($gAuth->GetAccessToken($redirect_uri) !== false) {
                $arLiveIDUser = $gAuth->GetCurrentUser();
                if ($arLiveIDUser['id'] != '') {
                    $email = $first_name = $last_name = "";
                    $login = "LiveID" . $arLiveIDUser['id'];
                    $uId = $arLiveIDUser['id'];
                    if ($arLiveIDUser['first_name'] != '') {
                        $first_name = $arLiveIDUser['first_name'];
                    }
                    if ($arLiveIDUser['last_name'] != '') {
                        $last_name = $arLiveIDUser['last_name'];
                    }
                    if ($arLiveIDUser['emails']['preferred'] != '') {
                        $email = $arLiveIDUser['emails']['preferred'];
                        $login = $arLiveIDUser['emails']['preferred'];
                        $uId = $arLiveIDUser['emails']['preferred'];
                    }
                    $arFields = array('EXTERNAL_AUTH_ID' => self::ID, 'XML_ID' => $uId, 'LOGIN' => $login, 'EMAIL' => $email, 'NAME' => $first_name, 'LAST_NAME' => $last_name);
                    $arFields["PERSONAL_WWW"] = $arLiveIDUser["link"];
                    if (strlen(SITE_ID) > 0) {
                        $arFields["SITE_ID"] = SITE_ID;
                    }
                    $bSuccess = $this->AuthorizeUser($arFields);
                }
            }
        }
        $url = $GLOBALS["APPLICATION"]->GetCurDir() == "/login/" ? "/auth/" : $GLOBALS["APPLICATION"]->GetCurDir();
        if (isset($_REQUEST["state"])) {
            $arState = array();
            parse_str($_REQUEST["state"], $arState);
            if (isset($arState['backurl'])) {
                $url = parse_url($arState['backurl'], PHP_URL_PATH);
            }
        }
        $aRemove = array("logout", "auth_service_error", "auth_service_id", "code", "error_reason", "error", "error_description", "check_key", "current_fieldset", "backurl", "state");
        if ($bSuccess === 2) {
            $url = preg_match("/\\?/", $url) ? $url . '&' : $url . '?';
            $url .= 'auth_service_id=' . self::ID . '&auth_service_error=' . $bSuccess;
        } elseif ($bSuccess !== true) {
            $url = isset($parseUrl) ? $parseUrl . '?auth_service_id=' . self::ID . '&auth_service_error=' . $bSuccess : $GLOBALS['APPLICATION']->GetCurPageParam('auth_service_id=' . self::ID . '&auth_service_error=' . $bSuccess, $aRemove);
        }
        if (CModule::IncludeModule("socialnetwork")) {
            $url = preg_match("/\\?/", $url) ? $url . "&current_fieldset=SOCSERV" : $url . "?current_fieldset=SOCSERV";
        }
        echo '
<script type="text/javascript">
if(window.opener)
	window.opener.location = \'' . CUtil::JSEscape($url) . '\';
window.close();
</script>
';
        die;
    }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:62,代码来源:liveidoauth.php

示例14: Authorize

	public function Authorize()
	{
		global $APPLICATION;

		$APPLICATION->RestartBuffer();
		$bSuccess = SOCSERV_AUTHORISATION_ERROR;
		if(isset($_REQUEST["code"]) && $_REQUEST["code"] != '' && CSocServAuthManager::CheckUniqueKey())
		{
			$redirect_uri= CSocServUtil::GetCurUrl('auth_service_id='.self::ID, array("code", "state", "backurl", "check_key", "current_fieldset"));
			$appID = trim(self::GetOption("liveid_appid"));
			$appSecret = trim(self::GetOption("liveid_appsecret"));

			$gAuth = new CLiveIDOAuthInterface($appID, $appSecret, $_REQUEST["code"]);

			if($gAuth->GetAccessToken($redirect_uri) !== false)
			{
				$arLiveIDUser = $gAuth->GetCurrentUser();

				if(is_array($arLiveIDUser) &&  ($arLiveIDUser['id'] <> ''))
				{
					$email = $first_name = $last_name = "";
					$login = "LiveID".$arLiveIDUser['id'];
					$uId = $arLiveIDUser['id'];
					if($arLiveIDUser['first_name'] <> '')
						$first_name = $arLiveIDUser['first_name'];
					if($arLiveIDUser['last_name'] <> '')
						$last_name = $arLiveIDUser['last_name'];
					if($arLiveIDUser['emails']['preferred'] <> '')
					{
						$email = $arLiveIDUser['emails']['preferred'];
						$login = $arLiveIDUser['emails']['preferred'];
						$uId = $arLiveIDUser['emails']['preferred'];
					}
					$arFields = array(
						'EXTERNAL_AUTH_ID' => self::ID,
						'XML_ID' => $uId,
						'LOGIN' => $login,
						'EMAIL' => $email,
						'NAME'=> $first_name,
						'LAST_NAME'=> $last_name,
					);
					$arFields["PERSONAL_WWW"] = $arLiveIDUser["link"];
					if(isset($arLiveIDUser['access_token']))
						$arFields["OATOKEN"] = $arLiveIDUser['access_token'];

					if(isset($arLiveIDUser['refresh_token']))
						$arFields["REFRESH_TOKEN"] = $arLiveIDUser['refresh_token'];

					if(isset($arLiveIDUser['expires_in']))
						$arFields["OATOKEN_EXPIRES"] = time() + $arLiveIDUser['expires_in'];
					if(strlen(SITE_ID) > 0)
						$arFields["SITE_ID"] = SITE_ID;
					$bSuccess = $this->AuthorizeUser($arFields);

				}
			}
		}
		$url = ($APPLICATION->GetCurDir() == "/login/") ? "" : $APPLICATION->GetCurDir();
		$aRemove = array("logout", "auth_service_error", "auth_service_id", "code", "error_reason", "error", "error_description", "check_key", "current_fieldset");

		$mode = 'opener';
		if(isset($_REQUEST["state"]))
		{
			$arState = array();
			parse_str($_REQUEST["state"], $arState);
			if(isset($arState['backurl']))
			{
				$parseUrl = parse_url($arState['backurl']);
				$urlPath = $parseUrl["path"];
				$arUrlQuery = explode('&', $parseUrl["query"]);

				foreach($arUrlQuery as $key => $value)
				{
					foreach($aRemove as $param)
					{
						if(strpos($value, $param."=") === 0)
						{
							unset($arUrlQuery[$key]);
							break;
						}
					}
				}

				$url = (!empty($arUrlQuery)) ? $urlPath.'?'.implode("&", $arUrlQuery) : $urlPath;
			}

			if(isset($arState['mode']))
			{
				$mode = $arState['mode'];
			}
		}
		if($bSuccess === SOCSERV_REGISTRATION_DENY)
		{
			$url = (preg_match("/\?/", $url)) ? $url.'&' : $url.'?';
			$url .= 'auth_service_id='.self::ID.'&auth_service_error='.SOCSERV_REGISTRATION_DENY;
		}
		elseif($bSuccess !== true)
			$url = (isset($urlPath)) ? $urlPath.'?auth_service_id='.self::ID.'&auth_service_error='.$bSuccess : $APPLICATION->GetCurPageParam(('auth_service_id='.self::ID.'&auth_service_error='.$bSuccess), $aRemove);
		if(CModule::IncludeModule("socialnetwork") && strpos($url, "current_fieldset=") === false)
			$url = (preg_match("/\?/", $url)) ? $url."&current_fieldset=SOCSERV" : $url."?current_fieldset=SOCSERV";
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:liveidoauth.php

示例15: getMessages

 public function getMessages($uid)
 {
     $fb = new CFacebookInterface();
     if (IsModuleInstalled('bitrix24') && defined('BX24_HOST_NAME')) {
         $redirect_uri = self::CONTROLLER_URL . "/redirect.php?redirect_to=" . urlencode(CSocServUtil::GetCurUrl('auth_service_id=' . self::ID, array("code")));
     } else {
         $redirect_uri = CSocServUtil::GetCurUrl('auth_service_id=' . self::ID, array("code"));
     }
     if ($fb->GetAccessToken($redirect_uri) !== false) {
         $res = $fb->getMessages($uid);
     }
     return $res;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:13,代码来源:facebook.php


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