Пример #1
0
<?php

/*
This is callback page for Dropbox OAuth 2.0 authentication.
Dropbox redirects only to specific back url set in the OAuth application.
The page opens in popup window after user authorized on Dropbox.
*/
define("NOT_CHECK_PERMISSIONS", true);
require_once $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/include/prolog_before.php";
if (CModule::IncludeModule("socialservices") && CSocServAuthManager::CheckUniqueKey()) {
    if (isset($_REQUEST["authresult"])) {
        $engine = $_REQUEST["engine"];
        \Bitrix\Seo\Service::clearAuth($engine, true);
        ?>
<script type="text/javascript">
	opener.location.reload();
	window.close();
</script>
<?php 
    } else {
        $result = array();
        $state = $_REQUEST["state"];
        if (isset($_REQUEST["code"]) && $_REQUEST["code"] != '') {
            $engine = \Bitrix\Seo\Service::getEngine();
            $engine->getInterface()->setCode($_REQUEST["code"]);
            if ($engine->getInterface()->GetAccessToken() !== false) {
                $engine->setAuthSettings($engine->getInterface()->getResult());
                $result["result"] = "ok";
            } else {
                $result = $engine->getInterface()->getError();
            }
Пример #2
0
 case 'register':
     if (!Service::isRegistered()) {
         try {
             Service::register();
             $res = array("result" => true);
         } catch (\Bitrix\Main\SystemException $e) {
             $res = array('error' => array('message' => $e->getMessage(), 'code' => $e->getCode()));
         }
     }
     break;
 case 'authorize':
     $authResult = Service::authorize();
     $res = array("result" => true, "location" => $authResult["location"]);
     break;
 case 'nullify_auth':
     Service::clearAuth($engine->getCode());
     $res = array("result" => true);
     break;
 case 'wordstat_report_clear':
 case 'wordstat_report':
     if ($_REQUEST['action'] == 'wordstat_report_clear') {
         $reportList = $engine->getWordstatReportList();
         if (count($reportList) >= Engine\YandexDirect::MAX_WORDSTAT_REPORTS) {
             foreach ($reportList as $firstReport) {
                 $engine->deleteWordstatReport($firstReport["ReportID"]);
                 break;
             }
         }
     }
     $phraseList = $_REQUEST['phrase'];
     $geo = trim($_REQUEST['geo']);