Beispiel #1
0
 public function checkPrivacy($blog)
 {
     $obj = new stdClass();
     $obj->allowed = EasyBlogHelper::isLoggedIn();
     $obj->message = '';
     // If it is public or site amdin, always allow browser to access.
     if (!$blog->access || EasyBlogHelper::isSiteAdmin()) {
         $obj->allowed = true;
         return $obj;
     }
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
     $easysocial = EasyBlogHelper::getHelper('EasySocial');
     if ($config->get('integrations_easysocial_privacy') && $easysocial->exists()) {
         switch ($blog->access) {
             case '10':
                 $obj->allowed = EasyBlogHelper::isLoggedIn();
                 $obj->error = $obj->allowed ? '' : $this->getErrorHTML();
                 break;
             case '30':
                 // if user is the blog author, we always allow.
                 $obj->allowed = $my->id == $blog->created_by ? true : false;
                 if (!$obj->allowed) {
                     $obj->allowed = Foundry::user($my->id)->isFriends($blog->created_by);
                 }
                 $obj->error = $obj->allowed ? '' : $this->getErrorHTML('privacy.friends');
                 break;
             case '40':
                 $obj->allowed = $my->id == $blog->created_by;
                 $obj->error = $obj->allowed ? '' : $this->getErrorHTML('privacy.owner');
                 break;
         }
         return $obj;
     } else {
         if ($config->get('main_jomsocial_privacy') && JFile::exists($file)) {
             switch ($blog->access) {
                 case '20':
                     $obj->allowed = EasyBlogHelper::isLoggedIn();
                     $obj->error = $obj->allowed ? '' : $this->getErrorHTML();
                     break;
                 case '30':
                     require_once $file;
                     $obj->allowed = CFactory::getUser($my->id)->isFriendWith($blog->created_by);
                     $obj->error = $obj->allowed ? '' : $this->getErrorHTML('privacy.friends');
                     break;
                 case '40':
                     $obj->allowed = $my->id == $blog->created_by;
                     $obj->error = $obj->allowed ? '' : $this->getErrorHTML('privacy.owner');
                     break;
             }
             return $obj;
         }
     }
     if ($blog->access) {
         $obj->allowed = EasyBlogHelper::isLoggedIn();
         $obj->error = $obj->allowed ? '' : $this->getErrorHTML();
     }
     // If not integrated with any privacy providers, we assume that the blog
     // is private.
     return $obj;
 }
Beispiel #2
0
 /**
  * This will be a callback from the oauth client.
  * @param	null
  * @return	null
  **/
 public function grant()
 {
     $type = JRequest::getCmd('type');
     $userId = JRequest::getVar('id');
     $mainframe = JFactory::getApplication();
     $config = EasyBlogHelper::getConfig();
     $key = $config->get('integrations_' . $type . '_api_key');
     $secret = $config->get('integrations_' . $type . '_secret_key');
     $my = JFactory::getUser($userId);
     $redirect = JRequest::getVar('redirect', '');
     $redirectUri = !empty($redirect) ? '&redirect=' . $redirect : '';
     // @task: Let's see if caller wants us to go to any specific location or not.
     if (!empty($redirect)) {
         $redirect = base64_decode($redirect);
     }
     if (!EasyBlogHelper::isLoggedIn()) {
         $mainframe->enqueueMessage(JText::_('COM_EASYBLOG_YOU_MUST_LOGIN_FIRST'), 'error');
         $this->setRedirect(JRoute::_('index.php?option=com_easyblog&view=users', false));
         return;
     }
     $oauth = EB::table('Oauth');
     $loaded = $oauth->loadByUser($my->id, $type);
     $denied = JRequest::getVar('denied', '');
     $call = JRequest::getWord('call');
     $callUri = !empty($call) ? '&call=' . $call . '&id=' . $my->id : '&id=' . $my->id;
     if (!empty($denied)) {
         $oauth->delete();
         $mainframe->enqueueMessage(JText::_('COM_EASYBLOG_OAUTH_DENIED_ERROR'), 'error');
         $redirect = JRoute::_('index.php?option=com_easyblog&view=users', false);
         $this->setRedirect($redirect, false);
         return;
     }
     if (!$loaded) {
         $mainframe->enqueueMessage(JText::_('COM_EASYBLOG_OAUTH_UNABLE_TO_LOCATE_RECORD'), 'error');
         $redirect = JRoute::_('index.php?option=com_easyblog&view=users', false);
         $this->setRedirect($redirect, false);
         return;
     }
     $request = EB::registry($oauth->request_token);
     $callback = rtrim(JURI::root(), '/') . '/administrator/index.php?option=com_easyblog&c=oauth&task=grant&type=' . $type . $redirect . $callUri;
     $consumer = EasyBlogOauthHelper::getConsumer($type, $key, $secret, $callback);
     $verifier = $consumer->getVerifier();
     if (empty($verifier)) {
         // Since there is a problem with the oauth authentication, we need to delete the existing record.
         $oauth->delete();
         JError::raiseError(500, JText::_('COM_EASYBLOG_INVALID_VERIFIER_CODE'));
     }
     $access = $consumer->getAccess($request->get('token'), $request->get('secret'), $verifier);
     if (!$access || empty($access->token) || empty($access->secret)) {
         // Since there is a problem with the oauth authentication, we need to delete the existing record.
         $oauth->delete();
         $mainframe->enqueueMessage(JText::_('COM_EASYBLOG_OAUTH_ACCESS_TOKEN_ERROR'), 'error');
         $this->setRedirect($redirect, false);
         return;
     }
     $param = EB::registry();
     $param->set('token', $access->token);
     $param->set('secret', $access->secret);
     if (isset($access->expires)) {
         $param->set('expires', $access->expires);
     }
     $oauth->access_token = $param->toString();
     $oauth->params = $access->params;
     $oauth->store();
     $mainframe->enqueueMessage(JText::_('Application revoked successfully.'));
     $url = JRoute::_('index.php?option=com_easyblog&c=user&id=' . $my->id . '&task=edit', false);
     if (!empty($redirect)) {
         $url = $redirect;
     }
     // @task: Let's see if the oauth client
     if (!empty($call)) {
         $consumer->{$call}();
     } else {
         $this->setRedirect($url);
     }
 }
Beispiel #3
0
 public static function getLikesAuthors($contentId, $type, $userId)
 {
     $db = EB::db();
     $config = EB::getConfig();
     $result = new stdClass();
     $displayFormat = $config->get('layout_nameformat');
     $displayName = '';
     switch ($displayFormat) {
         case "name":
             $displayName = 'a.name';
             break;
         case "username":
             $displayName = 'a.username';
             break;
         case "nickname":
         default:
             $displayName = 'b.nickname';
             break;
     }
     $query = 'select a.id as `user_id`, c.id, ' . $displayName . ' as `displayname`';
     $query .= ' FROM `#__users` as a';
     $query .= '  inner join `#__easyblog_users` as b';
     $query .= '    on a.id = b.id';
     $query .= '  inner join `#__easyblog_likes` as c';
     $query .= '    on a.id = c.created_by';
     $query .= ' where c.content_id = ' . $db->Quote($contentId);
     $query .= ' and c.`type` = ' . $db->Quote($type);
     $query .= ' order by c.id desc';
     $db->setQuery($query);
     $list = $db->loadObjectList();
     if (count($list) <= 0) {
         $result->string = '';
         $result->count = 0;
         return $result;
     }
     // else continue here
     $onwerInside = false;
     $names = array();
     for ($i = 0; $i < count($list); $i++) {
         if ($list[$i]->user_id == $userId) {
             $onwerInside = true;
             array_unshift($names, JText::_('COM_EASYBLOG_YOU'));
         } else {
             $names[] = $list[$i]->displayname;
         }
     }
     $max = 3;
     $total = count($names);
     $break = 0;
     if ($total == 1) {
         $break = $total;
     } else {
         if ($max >= $total) {
             $break = $total - 1;
         } elseif ($max < $total) {
             $break = $max;
         }
     }
     $main = array_slice($names, 0, $break);
     $remain = array_slice($names, $break);
     $stringFront = implode(", ", $main);
     $returnString = '';
     if (count($remain) > 1) {
         $returnString = JText::sprintf('COM_EASYBLOG_AND_OTHERS_LIKE_THIS', $stringFront, count($remain));
     } else {
         if (count($remain) == 1) {
             $returnString = JText::sprintf('COM_EASYBLOG_AND_LIKE_THIS', $stringFront, $remain[0]);
         } else {
             if (EasyBlogHelper::isLoggedIn() && $onwerInside) {
                 $returnString = JText::sprintf('COM_EASYBLOG_LIKE_THIS_SINGULAR', $stringFront);
             } else {
                 $returnString = JText::sprintf('COM_EASYBLOG_LIKE_THIS_PLURAL', $stringFront);
             }
         }
     }
     $result->count = $total;
     $result->string = $returnString;
     return $result;
 }
Beispiel #4
0
 function preview()
 {
     JPluginHelper::importPlugin('easyblog');
     $dispatcher = JDispatcher::getInstance();
     $mainframe = JFactory::getApplication();
     $acl = EasyBlogACLHelper::getRuleSet();
     $config = EasyBlogHelper::getConfig();
     $document = JFactory::getDocument();
     $my = JFactory::getUser();
     $params = $mainframe->getParams('com_easyblog');
     if (!EasyBlogHelper::isLoggedIn()) {
         EasyBlogHelper::showLogin();
         return;
     }
     $draftId = JRequest::getVar('draftid', '');
     $draft = EasyBlogHelper::getTable('Draft', 'Table');
     $draft->load($draftId);
     $blog = EasyBlogHelper::getTable('Blog', 'Table');
     $blog->bind($draft);
     $blogger = null;
     if ($blog->created_by != 0) {
         $blogger = EasyBlogHelper::getTable('Profile', 'Table');
         $blogger->load($blog->created_by);
     }
     // @rule: Set the author object into the table.
     $blog->author = $blogger;
     $blog->blogger = $blogger;
     $blogId = empty($draft->entry_id) ? $draft->id : $draft->entry_id;
     $limitstart = '0';
     $notice = '';
     $team = '';
     $blog->tags = empty($draft->tags) ? array() : $this->bindTags(explode(',', $draft->tags));
     // metas
     $meta = new stdClass();
     $meta->id = '';
     $meta->keywords = $draft->metakey;
     $meta->description = $draft->metadesc;
     $pageTitle = EasyBlogHelper::getPageTitle($config->get('main_title'));
     $document->setTitle($blog->title . $pageTitle);
     // process the video here if nessary
     $blog->intro = EasyBlogHelper::getHelper('Videos')->processVideos($blog->intro);
     $blog->content = EasyBlogHelper::getHelper('Videos')->processVideos($blog->content);
     // @rule: Process audio files.
     $blog->intro = EasyBlogHelper::getHelper('Audio')->process($blog->intro);
     $blog->content = EasyBlogHelper::getHelper('Audio')->process($blog->content);
     // @rule: Before any trigger happens, try to replace the gallery first and append it at the bottom.
     $blog->intro = EasyBlogHelper::getHelper('Gallery')->process($blog->intro, $blog->created_by);
     $blog->content = EasyBlogHelper::getHelper('Gallery')->process($blog->content, $blog->created_by);
     // Process jomsocial album's.
     $blog->intro = EasyBlogHelper::getHelper('Album')->process($blog->intro, $blog->created_by);
     $blog->content = EasyBlogHelper::getHelper('Album')->process($blog->content, $blog->created_by);
     // @trigger: onEasyBlogPrepareContent
     EasyBlogHelper::triggerEvent('easyblog.prepareContent', $blog, $params, $limitstart);
     //onPrepareContent trigger start
     $blog->introtext = $blog->intro;
     $blog->text = $blog->intro . $blog->content;
     // @trigger: onEasyBlogPrepareContent
     EasyBlogHelper::triggerEvent('prepareContent', $blog, $params, $limitstart);
     $blog->intro = $blog->introtext;
     $blog->content = $blog->text;
     $isFeatured = false;
     //page setup
     $blogHtml = '';
     $commentHtml = '';
     $blogHeader = '';
     $blogFooter = '';
     $adsenseHtml = '';
     $trackbackHtml = '';
     $blogger = null;
     if ($blog->created_by != 0) {
         $blogger = EasyBlogHelper::getTable('Profile', 'Table');
         $blogger->load($blog->created_by);
     }
     //onAfterDisplayTitle, onBeforeDisplayContent, onAfterDisplayContent trigger start
     $blog->event = new stdClass();
     // @trigger: onAfterDisplayTitle / onContentAfterTitle
     $results = EasyBlogHelper::triggerEvent('afterDisplayTitle', $blog, $params, $limitstart);
     $blog->event->afterDisplayTitle = JString::trim(implode("\n", $results));
     // @trigger: onBeforeDisplayContent / onContentBeforeDisplay
     $results = EasyBlogHelper::triggerEvent('beforeDisplayContent', $blog, $params, $limitstart);
     $blog->event->beforeDisplayContent = JString::trim(implode("\n", $results));
     // @trigger: onAfterDisplayContent / onContentAfterDisplay
     EasyBlogHelper::triggerEvent('afterDisplayContent', $blog, $params, $limitstart);
     $blog->event->afterDisplayContent = JString::trim(implode("\n", $results));
     if (!EasyBlogRouter::isCurrentActiveMenu('blogger', $blogger->id)) {
         $this->setPathway($blogger->getName(), $blogger->getLink());
     }
     if (!EasyBlogRouter::isCurrentActiveMenu('entry', $blog->id)) {
         $this->setPathway($blog->title, '');
     }
     $blog->totalComments = 0;
     // Facebook Like integrations
     require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'facebook.php';
     $facebookLike = EasyBlogFacebookLikes::getLikeHTML($blog);
     $url = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true);
     //get blog navigation object
     $blogNav = EasyBlogHelper::getBlogNavigation($blog->id, $blog->created, $team, 'team');
     //$team
     $prevLink = array();
     if (!empty($blogNav['prev'])) {
         $prevLink['id'] = $blogNav['prev'][0]->id;
         $prevLink['title'] = JString::strlen($blogNav['prev'][0]->title) > 50 ? JString::substr($blogNav['prev'][0]->title, 0, 50) . '...' : $blogNav['prev'][0]->title;
     }
     $nextLink = array();
     if (!empty($blogNav['next'])) {
         $nextLink['id'] = $blogNav['next'][0]->id;
         $nextLink['title'] = JString::strlen($blogNav['next'][0]->title) > 50 ? JString::substr($blogNav['next'][0]->title, 0, 50) . '...' : $blogNav['next'][0]->title;
     }
     // @rule: Hide introtext if necessary
     if ($config->get('main_hideintro_entryview')) {
         $blog->intro = '';
     }
     //get social bookmark provider.
     require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'bookmark.php';
     $bookmark = EasyBlogBookmark::getHTML();
     $theme = new CodeThemes();
     $theme->set('facebookLike', $facebookLike);
     $theme->set('notice', $notice);
     $theme->set('blog', $blog);
     $theme->set('tags', $blog->tags);
     $theme->set('blogger', $blogger);
     $theme->set('prevLink', $prevLink);
     $theme->set('nextLink', $nextLink);
     $theme->set('blogRelatedPost', '');
     $theme->set('isFeatured', $isFeatured);
     $theme->set('isMineBlog', true);
     $theme->set('acl', $acl);
     $theme->set('url', $url);
     $theme->set('commentHTML', $commentHtml);
     $theme->set('bookmark', $bookmark);
     $theme->set('pdfLinkProperties', EasyBlogHelper::getPDFlinkProperties());
     $theme->set('ispreview', true);
     // @task: trackbacks
     $trackbacks = '';
     $theme->set('trackbackURL', EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=trackback&post_id=' . $blog->id, true, true));
     $theme->set('trackbacks', $trackbacks);
     //google adsense
     require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'adsense.php';
     $adsense = EasyBlogGoogleAdsense::getHTML($blogger->id);
     $blogHeader = $adsense->header;
     $blogFooter = $adsense->footer;
     $theme->set('adsenseHTML', $adsense->beforecomments);
     $blogHtml = $theme->fetch('blog.read.php');
     echo $blogHeader;
     echo $blogHtml;
     echo $blogFooter;
 }
Beispiel #5
0
 /**
  * Micro blogging layout
  *
  * @since	3.0.7706
  * @access	public
  * @param	null
  * @return 	null
  */
 public function microblog()
 {
     $mainframe = JFactory::getApplication();
     $config = EasyBlogHelper::getConfig();
     $acl = EasyBlogACLHelper::getRuleSet();
     if (!EasyBlogHelper::isLoggedIn()) {
         EasyBlogHelper::showLogin();
         return;
     }
     $my = JFactory::getuser();
     $user = EasyBlogHelper::getTable('Profile', 'Table');
     $user->load($my->id);
     // @rule: Test if microblogging is allowed
     if (!$config->get('main_microblog')) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error');
         JFactory::getApplication()->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard', false));
     }
     // @rule: Test ACL if add entry is allowed
     if (!$acl->rules->add_entry) {
         $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard', false), JText::_('COM_EASYBLOG_NO_PERMISSION_TO_CREATE_BLOG'));
         $mainframe->close();
     }
     $document = JFactory::getDocument();
     $title = EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_DASHBOARD_SHARE_A_STORY_TITLE'));
     // @task: Set the page title
     parent::setPageTitle($title, false, $config->get('main_pagetitle_autoappend'));
     // Add toolbar to the output
     echo $this->showToolbar(__FUNCTION__, $user);
     // Get active tabs
     $activeType = JRequest::getVar('type', 'text');
     // Add the breadcrumbs
     $breadcrumbs = array(JText::_('COM_EASYBLOG_DASHBOARD_BREADCRUMB_SHARE_STORY') => '');
     // @task: Retrieve existing categories
     $categoryModel = $this->getModel('Categories');
     $categories = EasyBlogHelper::populateCategories('', '', 'select', 'category_id', '', true, true, true);
     // @task: Retrieve existing tags
     $tagsModel = $this->getModel('Tags');
     $tags = $tagsModel->getTags();
     $template = new CodeThemes('dashboard');
     $template->set('activeType', $activeType);
     $template->set('categories', $categories);
     $template->set('breadcrumbs', $breadcrumbs);
     $template->set('tags', $tags);
     echo $template->fetch('dashboard.microblog.php');
 }
Beispiel #6
0
 public function teamApproval()
 {
     $mainframe = JFactory::getApplication();
     $acl = EasyBlogACLHelper::getRuleSet();
     $config = EasyBlogHelper::getConfig();
     $document = JFactory::getDocument();
     $my = JFactory::getUser();
     if (!EasyBlogHelper::isLoggedIn()) {
         $uri = JFactory::getURI();
         $return = $uri->toString();
         $userComponent = EasyBlogHelper::getJoomlaVersion() >= '1.6' ? 'com_users' : 'com_user';
         $url = 'index.php?option=' . $userComponent . '&view=login';
         $url .= '&return=' . base64_encode($return);
         $mainframe->redirect(EasyBlogRouter::_($url, false), JText::_('COM_EASYBLOG_YOU_MUST_LOGIN_FIRST'));
     }
     $teamId = JRequest::getInt('team', 0);
     $approval = JRequest::getInt('approve');
     $requestId = JRequest::getInt('id', 0);
     //check if the current user have the right to approve this team request or not.
     $teamModel = $this->getModel('TeamBlogs');
     if (!EasyBlogHelper::isSiteAdmin()) {
         if (!$teamModel->checkIsTeamAdmin($my->id, $teamId)) {
             EasyBlogHelper::showAccessDenied();
             return;
         }
     }
     $request = EasyBlogHelper::getTable('TeamBlogRequest');
     $request->load($requestId);
     if ($approval) {
         $teamUsers = EasyBlogHelper::getTable('TeamBlogUsers', 'Table');
         $teamUsers->user_id = $request->user_id;
         $teamUsers->team_id = $request->team_id;
         if (!$teamUsers->addMember()) {
             EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_TEAMBLOG_APPROVAL_FAILED'), 'error');
             $this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=teamblogs', false));
         }
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_TEAMBLOG_APPROVAL_APPROVED'), 'info');
     } else {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_TEAMBLOG_APPROVAL_REJECTED'), 'info');
     }
     $request->ispending = 0;
     $request->store();
     $team = EasyBlogHelper::getTable('TeamBlog');
     $team->load($request->team_id);
     // @rule: Send notifications to the user that he's been approved.
     $request->sendApprovalEmail($approval);
     $this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=teamblogs', false));
 }
Beispiel #7
0
 function saveDraft($params, $content, $intro)
 {
     $ajax = new Ejax();
     $config = EasyBlogHelper::getConfig();
     if (!EasyBlogHelper::isLoggedIn()) {
         echo JText::_('COM_EASYBLOG_NOT_ALLOWED');
         exit;
     }
     $acl = EasyBlogACLHelper::getRuleSet();
     if (empty($acl->rules->add_entry)) {
         echo JText::_('COM_EASYBLOG_NOT_ALLOWED');
         exit;
     }
     // Try to load this draft to see if it exists
     $draft = EasyBlogHelper::getTable('Draft', 'Table');
     $draft->load($params['draft_id']);
     if (isset($params['id']) && !empty($params['id'])) {
         $draft->entry_id = $params['id'];
         unset($params['id']);
     }
     $draft->intro = $intro;
     $draft->content = $content;
     $draft->bind($params, true);
     if (isset($params['draft_id']) && !empty($params['draft_id'])) {
         $draft->id = $params['draft_id'];
     }
     $my = JFactory::getUser();
     if ($draft->id && $draft->created_by != $my->id && !EasyBlogHelper::isSiteAdmin()) {
         echo JText::_('COM_EASYBLOG_NOT_ALLOWED');
         exit;
     }
     $draft->store();
     $date = EasyBlogDateHelper::dateWithOffSet(EasyBlogHelper::getDate()->toMySQL());
     $date = EasyBlogDateHelper::toFormat($date, $config->get('layout_timeformat', '%I:%M:%S %p'));
     if (isset($date[0]) && $date[0] == 0) {
         $date = JString::substr($date, 1, JString::strlen($date));
     }
     $ajax->assign('draft_status span', JText::sprintf('COM_EASYBLOG_DRAFT_SAVED_TIME', $date));
     $ajax->script('$( "#draft_status" ).show();');
     $ajax->value('draft_id', $draft->id);
     $ajax->callback('');
     $ajax->send();
     return;
 }
Beispiel #8
0
 /**
  * Responsible to revoke access for the specific oauth client
  *
  * @param	null
  * @return	null
  **/
 public function revoke()
 {
     $mainframe = JFactory::getApplication();
     $my = JFactory::getUser();
     $url = EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false);
     $redirect = JRequest::getVar('redirect', '');
     $type = JRequest::getWord('type');
     $config = EasyBlogHelper::getConfig();
     if (!empty($redirect)) {
         $url = base64_decode($redirect);
     }
     if (!EasyBlogHelper::isLoggedIn()) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_YOU_MUST_LOGIN_FIRST'), 'error');
         $this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog', false));
         return;
     }
     $oauth = EasyBlogHelper::getTable('OAuth', 'Table');
     $oauth->loadByUser($my->id, $type);
     // Revoke the access through the respective client first.
     $callback = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&controller=oauth&task=grant&type=' . $type, false, true);
     $key = $config->get('integrations_' . $type . '_api_key');
     $secret = $config->get('integrations_' . $type . '_secret_key');
     $consumer = EasyBlogOauthHelper::getConsumer($type, $key, $secret, $callback);
     $consumer->setAccess($oauth->access_token);
     // @task: Only show errors when the user is really authenticated with the respective provider.
     if (!$consumer->revokeApp() && !empty($oauth->access_token)) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_APPLICATION_REVOKED_ERROR'), 'error');
         $this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
         return;
     }
     $oauth->delete();
     EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_APPLICATION_REVOKED_SUCCESSFULLY'));
     $this->setRedirect($url);
 }