Example #1
0
 $active_service = count($modules) == 0 ? false : in_array(substr($_GET['oauth_login'], 6), $modules);
 if (!$active_service) {
     $status = -1;
     $msg = 114;
     // resynch with remote account has failed but your other account information has been successfully saved.
 } else {
     $query = array_merge($_GET, $_POST);
     $service = $query['oauth_login'];
     // COM_errorLog("-------------------------------------------------------------------------");
     // COM_errorLog("usersettings.php?mode=resynch&oauth_login={$service}");
     // COM_errorLog("-------------------------------------------------------------------------");
     require_once $_CONF['path_system'] . 'classes/oauthhelper.class.php';
     $consumer = new OAuthConsumer($service);
     if ($service == 'oauth.facebook') {
         // facebook resynchronizations are simple to perform
         $oauth_userinfo = $consumer->refresh_userinfo();
         if (empty($oauth_userinfo)) {
             $msg = 114;
             // Account saved but re-synch failed.
             COM_errorLog($MESSAGE[$msg]);
         } else {
             $consumer->doSynch($oauth_userinfo);
         }
     } else {
         // other OAuth services are more complex
         // setup what we need to callback and authenticate
         $callback_query_string = $consumer->getCallback_query_string();
         // 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;