示例#1
0
 /**
  * displayEditYouTube 
  * 
  * @return void
  */
 function displayEditYouTube()
 {
     $this->displayHeader();
     $config = getYouTubeConfigData();
     $user = getYouTubeUserData($this->fcmsUser->id);
     // Setup url for callbacks
     $callbackUrl = getDomainAndDir();
     $callbackUrl .= 'settings.php?view=youtube';
     if (!empty($config['youtube_key'])) {
         if (!empty($user['youtube_session_token'])) {
             $httpClient = getYouTubeAuthSubHttpClient($config['youtube_key'], $user['youtube_session_token']);
             $youTubeService = new Zend_Gdata_YouTube($httpClient);
             $feed = $youTubeService->getUserProfile('default');
             if (!$feed instanceof Zend_Gdata_YouTube_UserProfileEntry) {
                 print '
         <div class="error-alert">' . T_('Could not get YouTube data for user.') . '</div>';
                 return;
             }
             $username = $feed->getUsername();
             $user = '******' . $username . '">' . $username . '</a>';
             $status = sprintf(T_('Currently connected as: %s'), $user);
             $link = '<a class="disconnect" href="?revoke=youtube">' . T_('Disconnect') . '</a>';
         } else {
             $url = Zend_Gdata_AuthSub::getAuthSubTokenUri($callbackUrl, 'http://gdata.youtube.com', false, true);
             $status = T_('Not Connected');
             $link = '<a href="' . $url . '">' . T_('Connect') . '</a>';
         }
     }
     echo '
     <div class="social-media-connect">
         <img class="icon" src="ui/img/youtube.png" alt="YouTube"/>
         <h2>YouTube</h2>
         <p>' . T_('YouTube allows users to discover, watch and share videos.') . '</p>
         <div class="status">' . $status . '</div>
         <div class="action">' . $link . '</div>
     </div>';
     $this->displayFooter();
 }
示例#2
0
/**
 * userConnectedSocialMedia 
 * 
 * @param int $userId 
 * 
 * @return boolean
 */
function userConnectedSocialMedia($userId)
{
    // Get Social Media data
    $facebook = getUserFacebookAccessToken($userId);
    $foursquare = getFoursquareUserData($userId);
    $youtube = getYouTubeUserData($userId);
    // Facebook
    if (!empty($facebook)) {
        return true;
    }
    // Foursquare
    if (!empty($foursquare['fs_user_id']) && !empty($foursquare['fs_access_token'])) {
        return true;
    }
    // YouTube
    if (!empty($youtube['youtube_session_token'])) {
        return true;
    }
    return false;
}