Exemple #1
0
	public function getUrl($arParams)
	{
		global $APPLICATION;

		$gAuth = new CVKontakteOAuthInterface();

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

			$backurl = $APPLICATION->GetCurPageParam(
				'check_key='.$_SESSION["UNIQUE_KEY"],
				array("logout", "auth_service_error", "auth_service_id", "backurl")
			);

			$state = 'site_id='.SITE_ID.'&backurl='.urlencode($backurl).(isset($arParams['BACKURL']) ? '&redirect_url='.urlencode($arParams['BACKURL']) : '');
		}

		return $gAuth->GetAuthUrl($redirect_uri, $state);
	}
Exemple #2
0
	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>';

	}
Exemple #3
0
	public function GetFormHtml($arParams)
	{
		$appID = self::GetOption("vkontakte_appid");
		$appSecret = self::GetOption("vkontakte_appsecret");

		$gAuth = new CVKontakteOAuthInterface($appID, $appSecret);
		$redirect_uri = CSocServUtil::GetCurUrl('auth_service_id='.self::ID);

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

		$url = $gAuth->GetAuthUrl($redirect_uri, $state);

		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>'.GetMessage("socserv_vk_note").'</span>';
	}