Example #1
0
 // COM_errorLog("callback_query_string={$callback_query_string}");
 $cancel_query_string = $consumer->getCancel_query_string();
 // COM_errorLog("cancel_query_string={$cancel_query_string}");
 $callback_url = $_CONF['site_url'] . '/usersettings.php?mode=synch&oauth_login=' . $service;
 // COM_errorLog("callback_url={$callback_url}");
 // authenticate with the remote service
 if (!isset($query[$callback_query_string]) && (empty($cancel_query_string) || !isset($query[$cancel_query_string]))) {
     $msg = 114;
     // Resynch with remote account has failed but other account information has been successfully saved
     // elseif the callback query string is set, then we have successfully authenticated
 } elseif (isset($query[$callback_query_string])) {
     // COM_errorLog("authenticated with remote service, retrieve userinfo");
     // foreach($query as $key=>$value) {
     //     COM_errorLog("query[{$key}]={$value}");
     // }
     $oauth_userinfo = $consumer->sreq_userinfo_response($query);
     if (empty($oauth_userinfo)) {
         $msg = 111;
         // Authentication error.
     } else {
         // COM_errorLog("resynchronizing userinfo");
         // foreach($oauth_userinfo as $key=>$value) {
         //     COM_errorLog("oauth_user_info[{$key}] set");
         // }
         $consumer->doSynch($oauth_userinfo);
     }
 } elseif (!empty($cancel_query_string) && isset($query[$cancel_query_string])) {
     $msg = 112;
     // Certification has been cancelled.
 } else {
     $msg = 91;