コード例 #1
1
ファイル: blogs.php プロジェクト: alexinteam/joomla3
 public function store($log = true)
 {
     // @rule: Load language file from the front end.
     JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
     $config = EasyBlogHelper::getConfig();
     $under_approval = false;
     if (isset($this->under_approval)) {
         $under_approval = true;
         // now we need to reset this variable from the blog object.
         unset($this->under_approval);
     }
     // @trigger: onBeforeSave
     $this->triggerBeforeSave();
     // @rule: Determine if this record is new or not.
     if (empty($this->isnew)) {
         $isNew = empty($this->id) ? true : false;
     } else {
         $isNew = true;
     }
     // @rule: Get the rulesets for this user.
     $acl = EasyBlogACLHelper::getRuleSet();
     // @rule: Process badword filters for title here.
     $blockedWord = EasyBlogHelper::getHelper('String')->hasBlockedWords($this->title);
     if ($blockedWord !== false) {
         $this->setError(JText::sprintf('COM_EASYBLOG_BLOG_TITLE_CONTAIN_BLOCKED_WORDS', $blockedWord));
         return false;
     }
     // @rule: Check for minimum words in the content if required.
     if ($config->get('main_post_min')) {
         $minimum = $config->get('main_post_length');
         $total = JString::strlen(strip_tags($this->intro . $this->content));
         if ($total < $minimum) {
             $this->setError(JText::sprintf('COM_EASYBLOG_CONTENT_LESS_THAN_MIN_LENGTH', $minimum));
             return false;
         }
     }
     // @rule: Check for invalid title
     if (empty($this->title) || $this->title == JText::_('COM_EASYBLOG_DASHBOARD_WRITE_DEFAULT_TITLE')) {
         $this->setError(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_EMPTY_TITLE_ERROR'));
         return false;
     }
     // @rule: For edited blogs, ensure that they have permissions to edit it.
     if (!$isNew && $this->created_by != JFactory::getUser()->id && !EasyBlogHelper::isSiteAdmin() && empty($acl->rules->moderate_entry)) {
         if (!class_exists('EasyBlogModelTeamBlogs')) {
             jimport('joomla.application.component.model');
             JLoader::import('blog', EBLOG_ROOT . DIRECTORY_SEPARATOR . 'models');
         }
         // @task: Only throw error when this blog post is not a team blog post and it's not owned by the current logged in user.
         JModel::addIncludePath(JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'models');
         $model = JModel::getInstance('TeamBlogs', 'EasyBlogModel');
         $contribution = $model->getBlogContributed($this->id);
         if (!$contribution || !$model->checkIsTeamAdmin(JFactory::getUser()->id, $contribution->team_id)) {
             $this->setError(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_EDIT_BLOG'));
             return false;
         }
     }
     // @rule: Every blog post must be assigned to a category
     if (empty($this->category_id)) {
         $this->setError(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_EMPTY_CATEGORY_ERROR'));
         return false;
     }
     // Filter / strip contents that are not allowed
     $filterTags = EasyBlogHelper::getHelper('Acl')->getFilterTags();
     $filterAttributes = EasyBlogHelper::getHelper('Acl')->getFilterAttributes();
     // @rule: Apply filtering on contents
     jimport('joomla.filter.filterinput');
     $inputFilter = JFilterInput::getInstance($filterTags, $filterAttributes, 1, 1, 0);
     $inputFilter->tagBlacklist = $filterTags;
     $inputFilter->attrBlacklist = $filterAttributes;
     if (count($filterTags) > 0 && !empty($filterTags[0]) || count($filterAttributes) > 0 && !empty($filterAttributes[0])) {
         $this->intro = $inputFilter->clean($this->intro);
         $this->content = $inputFilter->clean($this->content);
     }
     // @rule: Process badword filters for content here.
     $blockedWord = EasyBlogHelper::getHelper('String')->hasBlockedWords($this->intro . $this->content);
     if ($blockedWord !== false) {
         $this->setError(JText::sprintf('COM_EASYBLOG_BLOG_POST_CONTAIN_BLOCKED_WORDS', $blockedWord));
         return false;
     }
     // @rule: Test for the empty-ness
     if (empty($this->intro) && empty($this->content)) {
         $this->setError(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_CONTENT_ERROR'));
     }
     // alway set this to false no matter what! TODO: remove this column.
     $this->ispending = '0';
     $state = parent::store();
     $source = JRequest::getVar('blog_contribute_source', 'easyblog');
     // @trigger: onBeforeSave
     $this->triggerAfterSave();
     // if this is blog edit, then we should see the column isnew to determine
     // whether the post is really new or not.
     if (!$isNew) {
         $isNew = $this->isnew;
     }
     // @task: If auto featured is enabled, we need to feature the blog post automatically since the blogger is featured.
     if ($config->get('main_autofeatured', 0) && EasyBlogHelper::isFeatured('blogger', $this->created_by) && !EasyBlogHelper::isFeatured('post', $this->id)) {
         EasyBlogHelper::makeFeatured('post', $this->id);
     }
     // @task: This is when the blog is either created or updated.
     if ($source == 'easyblog' && $state && $this->published == POST_ID_PUBLISHED && $log) {
         // @rule: Add new stream item in jomsocial
         EasyBlogHelper::addJomSocialActivityBlog($this, $isNew);
         // @rule: Log new stream item into EasyBlog
         $activity = new stdClass();
         $activity->actor_id = $this->created_by;
         $activity->target_id = '0';
         $activity->context_type = 'post';
         $activity->context_id = $this->id;
         $activity->verb = $isNew ? 'add' : 'update';
         $activity->uuid = $this->title;
         EasyBlogHelper::activityLog($activity);
     }
     if ($source == 'easyblog' && $state && $this->published == POST_ID_PUBLISHED && $isNew && $log) {
         // @rule: Send email notifications out to subscribers.
         $author = EasyBlogHelper::getTable('Profile');
         $author->load($this->created_by);
         // @rule: Ping pingomatic
         if ($config->get('main_pingomatic')) {
             if (!EasyBlogHelper::getHelper('Pingomatic')->ping($this->title, EasyBlogHelper::getExternalLink('index.php?option=com_easyblog&view=entry&id=' . $this->id, true))) {
                 EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_PINGOMATIC_ERROR'), 'error');
             }
         }
         // Assign EasySocial points
         $easysocial = EasyBlogHelper::getHelper('EasySocial');
         $easysocial->assignPoints('blog.create', $this->created_by);
         // @rule: Add userpoints for jomsocial
         if ($config->get('main_jomsocial_userpoint')) {
             $path = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'userpoints.php';
             if (JFile::exists($path)) {
                 require_once $path;
                 CUserPoints::assignPoint('com_easyblog.blog.add', $this->created_by);
             }
         }
         $link = $this->getExternalBlogLink('index.php?option=com_easyblog&view=entry&id=' . $this->id);
         // @rule: Add notifications for jomsocial 2.6
         if ($config->get('integrations_jomsocial_notification_blog')) {
             // Get list of users who subscribed to this blog.
             $target = $this->getRegisteredSubscribers('new', array($this->created_by));
             EasyBlogHelper::getHelper('JomSocial')->addNotification(JText::sprintf('COM_EASYBLOG_JOMSOCIAL_NOTIFICATIONS_NEW_BLOG', $author->getName(), $link, $this->title), 'easyblog_new_blog', $target, $this->created_by, $link);
         }
         // @rule: Mighty Touch karma points
         EasyBlogHelper::getHelper('MightyTouch')->setKarma($this->created_by, 'new_blog');
         // @rule: Integrations with EasyDiscuss
         EasyBlogHelper::getHelper('EasyDiscuss')->log('easyblog.new.blog', $this->created_by, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_HISTORY_NEW_BLOG', $this->title));
         EasyBlogHelper::getHelper('EasyDiscuss')->addPoint('easyblog.new.blog', $this->created_by);
         EasyBlogHelper::getHelper('EasyDiscuss')->addBadge('easyblog.new.blog', $this->created_by);
         // Assign badge for users that report blog post.
         // Only give points if the viewer is viewing another person's blog post.
         EasyBlogHelper::getHelper('EasySocial')->assignBadge('blog.create', JText::_('COM_EASYBLOG_EASYSOCIAL_BADGE_CREATE_BLOG_POST'));
         if ($config->get('integrations_easydiscuss_notification_blog')) {
             // Get list of users who subscribed to this blog.
             $target = $this->getRegisteredSubscribers('new', array($this->created_by));
             EasyBlogHelper::getHelper('EasyDiscuss')->addNotification($this, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_NOTIFICATIONS_NEW_BLOG', $author->getName(), $this->title), EBLOG_NOTIFICATIONS_TYPE_BLOG, $target, $this->created_by, $link);
         }
         $my = JFactory::getUser();
         // @rule: Add points for AlphaUserPoints
         if ($my->id == $this->created_by && EasyBlogHelper::isAUPEnabled()) {
             // get blog post URL
             $url = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $this->id);
             $aupid = AlphaUserPointsHelper::getAnyUserReferreID($this->created_by);
             AlphaUserPointsHelper::newpoints('plgaup_easyblog_add_blog', $aupid, 'easyblog_add_blog_' . $this->id, JText::sprintf('COM_EASYBLOG_AUP_NEW_BLOG_CREATED', $url, $this->title));
         }
         // @rule: Process trackbacks
         $this->processTrackbacks();
         // Update the isnew column so that if user edits this entry again, it doesn't send any notifications the second time.
         $this->isnew = 0;
         $this->store(false);
     }
     return $state;
 }
コード例 #2
0
ファイル: reports.php プロジェクト: Tommar/vino2
 /**
  * Process report items.
  *
  * @access	public
  * @param	null
  **/
 public function submitReport()
 {
     JRequest::checkToken() or die('Invalid Token');
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     if (!$my->id && !$config->get('main_reporting_guests')) {
         echo JText::_('COM_EASYBLOG_CATEGORIES_FOR_REGISTERED_USERS_ONLY');
         exit;
     }
     $objId = JRequest::getInt('obj_id');
     $objType = JRequest::getCmd('obj_type');
     $reason = JRequest::getString('reason');
     // @task: Ensure that the reason is never empty.
     if (empty($reason)) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_REPORT_PLEASE_SPECIFY_REASON'), 'error');
         $this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $objId, false));
         return;
     }
     $report = EasyBlogHelper::getTable('Report');
     $report->set('obj_id', $objId);
     $report->set('obj_type', $objType);
     $report->set('reason', $reason);
     $report->set('created', EasyBlogHelper::getDate()->toMySQL());
     $report->set('created_by', $my->id);
     $report->set('ip', @$_SERVER['REMOTE_ADDR']);
     if (!$report->store()) {
         $error = $report->getError();
         EasyBlogHelper::setMessageQueue($error, 'error');
         $this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $objId, false));
         return;
     }
     // @TODO: Configurable report links
     switch ($objType) {
         case EBLOG_REPORTING_POST:
         default:
             $blog = EasyBlogHelper::getTable('Blog');
             $blog->load($objId);
             $report->notify($blog);
             $message = JText::_('COM_EASYBLOG_THANKS_FOR_REPORTING');
             $redirect = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $objId, false);
             break;
     }
     EasyBlogHelper::setMessageQueue($message);
     $this->setRedirect($redirect);
 }
コード例 #3
0
ファイル: view.html.php プロジェクト: Tommar/vino2
 function display($tmpl = null)
 {
     $mainframe = JFactory::getApplication();
     $my = JFactory::getuser();
     if (empty($my->id)) {
         $return = JRequest::getVar('return', '');
         EasyBlogHelper::showLogin($return);
         return;
     } else {
         $showPermissionMsg = JRequest::getVar('showpermissionmsg', '');
         if ($showPermissionMsg) {
             EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_YOU_DO_NOT_HAVE_PERMISSION_TO_VIEW'), 'error');
         } else {
             EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_YOU_ARE_ALREADY_LOGIN'), 'error');
             $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=latest'));
         }
     }
 }
コード例 #4
0
ファイル: subscription.php プロジェクト: Tommar/vino2
 function unsubscribe()
 {
     $my = JFactory::getUser();
     $redirectLInk = 'index.php?option=com_easyblog&view=subscription';
     if ($my->id == 0) {
         $redirectLInk = 'index.php?option=com_easyblog&view=latest';
     }
     //type=site - subscription type
     //sid=1 - subscription id
     //uid=42 - user id
     //token=0fd690b25dd9e4d2dc47a252d025dff4 - md5 subid.subdate
     $data = base64_decode(JRequest::getVar('data', ''));
     $param = EasyBlogHelper::getRegistry($data);
     $param->type = $param->get('type', '');
     $param->sid = $param->get('sid', '');
     $param->uid = $param->get('uid', '');
     $param->token = $param->get('token', '');
     $subtable = EasyBlogHelper::getTable($param->type, 'Table');
     $subtable->load($param->sid);
     $token = md5($subtable->id . $subtable->created);
     $paramToken = md5($param->sid . $subtable->created);
     if ($subtable->id != 0) {
         if ($token != $paramToken) {
             EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_SUBSCRIPTION_UNSUBSCRIBE_FAILED'), 'error');
             $this->setRedirect(EasyBlogRouter::_($redirectLInk, false));
             return false;
         }
         if (!$subtable->delete($param->sid)) {
             EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_SUBSCRIPTION_UNSUBSCRIBE_FAILED_ERROR_DELETING_RECORDS'), 'error');
             $this->setRedirect(EasyBlogRouter::_($redirectLInk, false));
             return false;
         }
     }
     EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_SUBSCRIPTION_UNSUBSCRIBE_SUCCESS'));
     $this->setRedirect(EasyBlogRouter::_($redirectLInk, false));
     return true;
 }
コード例 #5
0
ファイル: helper.php プロジェクト: Tommar/vino2
 public static function uploadMediaAvatar($mediaType, $mediaTable, $isFromBackend = false)
 {
     jimport('joomla.utilities.error');
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     $my = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     $config = EasyBlogHelper::getConfig();
     $acl = EasyBlogACLHelper::getRuleSet();
     // required params
     $layout_type = $mediaType == 'category' ? 'categories' : 'teamblogs';
     $view_type = $mediaType == 'category' ? 'categories' : 'teamblogs';
     $default_avatar_type = $mediaType == 'category' ? 'default_category.png' : 'default_team.png';
     if (!$isFromBackend && $mediaType == 'category') {
         if (empty($acl->rules->upload_cavatar)) {
             $url = 'index.php?option=com_easyblog&view=dashboard&layout=' . $layout_type;
             EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_UPLOAD_AVATAR'), 'warning');
             $mainframe->redirect(EasyBlogRouter::_($url, false));
         }
     }
     $avatar_config_path = $mediaType == 'category' ? $config->get('main_categoryavatarpath') : $config->get('main_teamavatarpath');
     $avatar_config_path = rtrim($avatar_config_path, '/');
     $avatar_config_path = str_replace('/', DIRECTORY_SEPARATOR, $avatar_config_path);
     $upload_path = JPATH_ROOT . DIRECTORY_SEPARATOR . $avatar_config_path;
     $rel_upload_path = $avatar_config_path;
     $err = null;
     $file = JRequest::getVar('Filedata', '', 'files', 'array');
     //check whether the upload folder exist or not. if not create it.
     if (!JFolder::exists($upload_path)) {
         if (!JFolder::create($upload_path)) {
             // Redirect
             if (!$isFromBackend) {
                 EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_IMAGE_UPLOADER_FAILED_TO_CREATE_UPLOAD_FOLDER'), 'error');
                 self::setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=' . $layout_type, false));
             } else {
                 //from backend
                 self::setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=' . $layout_type, false), JText::_('COM_EASYBLOG_IMAGE_UPLOADER_FAILED_TO_CREATE_UPLOAD_FOLDER'), 'error');
             }
             return;
         } else {
             // folder created. now copy index.html into this folder.
             if (!JFile::exists($upload_path . DIRECTORY_SEPARATOR . 'index.html')) {
                 $targetFile = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'index.html';
                 $destFile = $upload_path . DIRECTORY_SEPARATOR . 'index.html';
                 if (JFile::exists($targetFile)) {
                     JFile::copy($targetFile, $destFile);
                 }
             }
         }
     }
     //makesafe on the file
     $file['name'] = $mediaTable->id . '_' . JFile::makeSafe($file['name']);
     if (isset($file['name'])) {
         $target_file_path = $upload_path;
         $relative_target_file = $rel_upload_path . DIRECTORY_SEPARATOR . $file['name'];
         $target_file = JPath::clean($target_file_path . DIRECTORY_SEPARATOR . JFile::makeSafe($file['name']));
         $isNew = false;
         //include_once(JPATH_ROOT.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_easyblog'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'image.php');
         require_once EBLOG_HELPERS . DIRECTORY_SEPARATOR . 'image.php';
         require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'easysimpleimage.php';
         if (!EasyImageHelper::canUpload($file, $err)) {
             if (!$isFromBackend) {
                 EasyBlogHelper::setMessageQueue(JText::_($err), 'error');
                 $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=' . $layout_type, false));
             } else {
                 //from backend
                 $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=' . $view_type, false), JText::_($err), 'error');
             }
             return;
         }
         if (0 != (int) $file['error']) {
             if (!$isFromBackend) {
                 EasyBlogHelper::setMessageQueue($file['error'], 'error');
                 $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=' . $layout_type, false));
             } else {
                 //from backend
                 $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=' . $view_type, false), $file['error'], 'error');
             }
             return;
         }
         //rename the file 1st.
         $oldAvatar = empty($mediaTable->avatar) ? $default_avatar_type : $mediaTable->avatar;
         $tempAvatar = '';
         if ($oldAvatar != $default_avatar_type) {
             $session = JFactory::getSession();
             $sessionId = $session->getToken();
             $fileExt = JFile::getExt(JPath::clean($target_file_path . DIRECTORY_SEPARATOR . $oldAvatar));
             $tempAvatar = JPath::clean($target_file_path . DIRECTORY_SEPARATOR . $sessionId . '.' . $fileExt);
             JFile::move($target_file_path . DIRECTORY_SEPARATOR . $oldAvatar, $tempAvatar);
         } else {
             $isNew = true;
         }
         if (JFile::exists($target_file)) {
             if ($oldAvatar != $default_avatar_type) {
                 //rename back to the previous one.
                 JFile::move($tempAvatar, $target_file_path . DIRECTORY_SEPARATOR . $oldAvatar);
             }
             if (!$isFromBackend) {
                 EasyBlogHelper::setMessageQueue(JText::sprintf('ERROR.FILE_ALREADY_EXISTS', $relative_target_file), 'error');
                 $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=' . $layout_type, false));
             } else {
                 //from backend
                 $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=' . $view_type, false), JText::sprintf('ERROR.FILE_ALREADY_EXISTS', $relative_target_file), 'error');
             }
             return;
         }
         if (JFolder::exists($target_file)) {
             if ($oldAvatar != $default_avatar_type) {
                 //rename back to the previous one.
                 JFile::move($tempAvatar, $target_file_path . DIRECTORY_SEPARATOR . $oldAvatar);
             }
             if (!$isFromBackend) {
                 //JError::raiseNotice(100, JText::sprintf('ERROR.FOLDER_ALREADY_EXISTS',$relative_target_file));
                 EasyBlogHelper::setMessageQueue(JText::sprintf('ERROR.FOLDER_ALREADY_EXISTS', $relative_target_file), 'error');
                 $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=' . $layout_type, false));
             } else {
                 //from backend
                 $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=' . $view_type, false), JText::sprintf('ERROR.FILE_ALREADY_EXISTS', $relative_target_file), 'error');
             }
             return;
         }
         $configImageWidth = EBLOG_AVATAR_LARGE_WIDTH;
         $configImageHeight = EBLOG_AVATAR_LARGE_HEIGHT;
         $image = new EasySimpleImage();
         $image->load($file['tmp_name']);
         $image->resizeToFill($configImageWidth, $configImageHeight);
         $image->save($target_file, $image->image_type);
         //now we update the user avatar. If needed, we remove the old avatar.
         if ($oldAvatar != $default_avatar_type) {
             if (JFile::exists($tempAvatar)) {
                 JFile::delete($tempAvatar);
             }
         }
         return JFile::makeSafe($file['name']);
     } else {
         return $default_avatar_type;
     }
 }
コード例 #6
0
ファイル: view.html.php プロジェクト: Tommar/vino2
 function display($tmpl = null)
 {
     JPluginHelper::importPlugin('easyblog');
     $dispatcher = JDispatcher::getInstance();
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $config = EasyBlogHelper::getConfig();
     $my = JFactory::getUser();
     $notice = '';
     //for trigger
     $params = $mainframe->getParams('com_easyblog');
     $limitstart = JRequest::getInt('limitstart', 0, '');
     $blogId = JRequest::getVar('id');
     if (JRequest::getInt('print') == 1) {
         // Add noindex for print view by default.
         $document->setMetadata('robots', 'noindex,follow');
     }
     if (empty($blogId)) {
         $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false), JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
         $mainframe->close();
     }
     if ($my->id <= 0 && $config->get('main_login_read')) {
         $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blogId . '&layout=login', false));
         $mainframe->close();
     }
     $team = JRequest::getVar('team', '');
     if (empty($team)) {
         //try get from session.
         $team = EasyBlogHelper::getSession('EASYBLOG_TEAMBLOG_ID');
     }
     // set meta tags for post
     EasyBlogHelper::setMeta($blogId, META_TYPE_POST);
     $print = JRequest::getBool('print');
     if ($print) {
         $document->setMetaData('robots', 'noindex, nofollow');
     }
     $my = JFactory::getUser();
     $blog = EasyBlogHelper::getTable('Blog', 'Table');
     if (!$blog->load($blogId)) {
         $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false), JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
         $mainframe->close();
     }
     if (!empty($blog->robots)) {
         $document->setMetaData('robots', $blog->robots);
     }
     if (!empty($blog->copyrights)) {
         $document->setMetaData('rights', $blog->copyrights);
     }
     //assign the teamid here.
     $checkIsPrivate = false;
     //check if blog is password protected.
     if ($config->get('main_password_protect', true) && !empty($blog->blogpassword)) {
         if (!EasyBlogHelper::verifyBlogPassword($blog->blogpassword, $blog->id)) {
             $errmsg = '';
             $jSession = JFactory::getSession();
             if ($jSession->has('PROTECTEDBLOG_' . $blog->id, 'EASYBLOG')) {
                 $errmsg = JText::_('COM_EASYBLOG_PASSWORD_PROTECTED_BLOG_INVALID_PASSWORD');
             }
             $theme = new CodeThemes();
             $theme->set('id', $blog->id);
             $theme->set('return', base64_encode(JURI::getInstance()->toString()));
             $theme->set('errmsg', $errmsg);
             echo $theme->fetch('blog.protected.php');
             return false;
         }
     }
     //if team id provided, then we need to check if the user belong to the team or not.
     if ($blog->issitewide) {
         $checkIsPrivate = true;
     } else {
         if (empty($team)) {
             // blog post is not sitewide and teamid is empty? this is not so right. need to check this post contributed to which team one more time.
             $team = $blog->getTeamContributed();
         }
         /*
          * if teamblog access set to 'member only' | 'registered user', team blog will supersede blog permision
          * if teamblog access set to 'everyone' then blog's permission will supersede teamblog access (logged user vs guest)
          */
         if (!empty($team)) {
             $teamblog = EasyBlogHelper::getTable('TeamBlog', 'Table');
             $teamblog->load($team);
             if ($teamblog->access == '1') {
                 if (!EasyBlogHelper::isTeamBlogJoined($my->id, $team)) {
                     //show error.
                     EasyBlogHelper::showAccessDenied('teamblog', $teamblog->access);
                     return;
                 }
             } else {
                 if ($teamblog->access == '2') {
                     if (!EasyBlogHelper::isLoggedIn()) {
                         EasyBlogHelper::showLogin();
                         return;
                     }
                 } else {
                     // if teamblog the access set to 'everyone' then blog permission will supersede teamblog access
                     $checkIsPrivate = true;
                 }
             }
         } else {
             $checkIsPrivate = true;
         }
     }
     $blog->team_id = $team;
     //check if the blog permission set to private or public. if private, we
     //need to check if the user has login or not.
     if ($checkIsPrivate) {
         $privacy = $blog->isAccessible();
         if (!$privacy->allowed) {
             echo $privacy->error;
             return;
         }
     }
     // added checking for other statuses
     switch ($blog->published) {
         case 0:
         case 2:
         case 3:
             // Unpublished post
             // Only Admin and blog owner can view this post
             if ($my->id == $blog->created_by) {
                 $notice = JText::_('COM_EASYBLOG_ENTRY_BLOG_UNPUBLISHED_VISIBLE_TO_OWNER');
             } elseif (EasyBlogHelper::isSiteAdmin()) {
                 $notice = JText::_('COM_EASYBLOG_ENTRY_BLOG_UNPUBLISHED_VISIBLE_TO_ADMIN');
             } else {
                 EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
                 $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false));
             }
             break;
         case 5:
             // Trashed posts.
             EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
             $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false));
             break;
         case 1:
         default:
             break;
     }
     //update the hits
     $blog->hit();
     $acl = EasyBlogACLHelper::getRuleSet();
     $pageTitle = EasyBlogHelper::getPageTitle($config->get('main_title'));
     if (empty($pageTitle)) {
         $document->setTitle($blog->title);
     } else {
         $document->setTitle($blog->title . ' - ' . $pageTitle);
     }
     // There is a possibility that the intro is hidden in the entry view, so we need to get this data.
     $rawIntroText = $blog->intro;
     // @rule: Process microblog post
     if ($blog->source) {
         EasyBlogHelper::formatMicroBlog($blog);
     }
     // 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: Process adsense codes.
     $blog->intro = EasyBlogGoogleAdsense::processsAdsenseCode($blog->intro, $blog->created_by);
     $blog->content = EasyBlogGoogleAdsense::processsAdsenseCode($blog->content, $blog->created_by);
     // @trigger: onEasyBlogPrepareContent
     EasyBlogHelper::triggerEvent('easyblog.prepareContent', $blog, $params, $limitstart);
     // @rule: Hide introtext if necessary
     if ($config->get('main_hideintro_entryview') && !empty($blog->content)) {
         $blog->intro = '';
     }
     //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;
     // @legacy: since 3.5 has blog images, we can remove this in the future.
     // Remove first image for featured blogs
     if ($blog->isFeatured()) {
         $blog->content = EasyBlogHelper::removeFeaturedImage($blog->content);
     }
     $isFeatured = EasyBlogHelper::isFeatured('post', $blog->id);
     /* Post Tags */
     $modelPT = $this->getModel('PostTag');
     $tags = $modelPT->getBlogTags($blog->id);
     //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);
     }
     // @rule: Set the author object into the table.
     $blog->author = $blogger;
     $blog->blogger = $blogger;
     // @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);
     $blog->intro = EasyBlogHelper::getHelper('Album')->process($blog->intro, $blog->created_by);
     $blog->content = EasyBlogHelper::getHelper('Album')->process($blog->content, $blog->created_by);
     //onAfterDisplayTitle, onBeforeDisplayContent, onAfterDisplayContent trigger start
     $blog->event = new stdClass();
     $blog->introtext = $blog->intro;
     $blog->text = $blog->content;
     // @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
     $results = EasyBlogHelper::triggerEvent('afterDisplayContent', $blog, $params, $limitstart);
     $blog->event->afterDisplayContent = JString::trim(implode("\n", $results));
     $blog->intro = $blog->introtext;
     $blog->content = $blog->text;
     unset($blog->introtext);
     unset($blog->text);
     if ($print) {
         $theme = new CodeThemes();
         $theme->set('blog', $blog);
         $theme->set('tags', $tags);
         $theme->set('config', $config);
         $theme->set('blogger', $blogger);
         echo $theme->fetch('blog.read.print.php');
         return;
     }
     if (!EasyBlogRouter::isCurrentActiveMenu('blogger', $blogger->id) && $config->get('layout_blogger_breadcrumb')) {
         $this->setPathway($blogger->getName(), $blogger->getLink());
     }
     if (!EasyBlogRouter::isCurrentActiveMenu('entry', $blog->id)) {
         $this->setPathway($blog->title, '');
     }
     $blogModel = $this->getModel('Blog');
     $theme = new CodeThemes();
     // add checking if comment system disabled by site owner
     if ($config->get('main_comment') && $blog->allowcomment) {
         // getting blog comments
         $commentModel = $this->getModel('Comment');
         $blogComments = EasyBlogHelper::getHelper('Comment')->getBlogComment($blogId);
         $commtPagination = EasyBlogHelper::getHelper('Comment')->pagination;
         $comments = array();
         if (!empty($blogComments)) {
             foreach ($blogComments as $comment) {
                 $row = $comment;
                 $row->comment = EasyBlogCommentHelper::parseBBCode($row->comment);
                 if ($config->get('comment_likes')) {
                     $row->likesAuthor = EasyBlogHelper::getLikesAuthors($row->id, 'comment', $my->id);
                     $row->isLike = $commentModel->isLikeComment($row->id, $my->id);
                 } else {
                     $row->likesAuthor = '';
                     $row->isLike = 0;
                 }
                 $comments[] = $row;
             }
         }
         // compliant with the #comments at blog.item.comment.php
         $commentHtml = $config->get('comment_jcomments') ? '' : '<a id="comments"></a>';
         $commentHtml .= EasyBlogCommentHelper::getCommentHTML($blog, $comments, $commtPagination);
     }
     $blog->totalComments = EasyBlogHelper::getHelper('Comment')->getCommentCount($blog);
     //get related blog post
     $blogRelatedPost = '';
     if ($config->get('main_relatedpost', true)) {
         $blogRelatedPost = $blogModel->getRelatedBlog($blogId);
     }
     //get author's recent posts.
     $authorRecentPosts = '';
     if ($config->get('main_showauthorinfo') && $config->get('main_showauthorposts')) {
         $authorPostLimit = $config->get('main_showauthorpostscount');
         $authorRecentPosts = $blogModel->getBlogsBy('blogger', $blog->created_by, 'latest', $authorPostLimit);
     }
     // Facebook Like integrations
     require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'facebook.php';
     $facebookLike = EasyBlogFacebookLikes::getLikeHTML($blog, $rawIntroText);
     $url = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true);
     // @rule: Add opengraph tags if required.
     if ($config->get('main_facebook_opengraph')) {
         EasyBlogFacebookLikes::addOpenGraphTags($blog, $rawIntroText);
     }
     // Add Twitter card details on page.
     EasyBlogHelper::getHelper('Twitter')->addCard($blog, $rawIntroText);
     // @task: Add canonical URLs.
     if ($config->get('main_canonical_entry')) {
         $canonicalUrl = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true, true);
         $document->addCustomTag('<link rel="canonical" href="' . $canonicalUrl . '"/>');
     }
     // @task: Add rel="nofollow" if necessary.
     if ($config->get('main_anchor_nofollow')) {
         $blog->content = EasyBlogHelper::addNoFollow($blog->content);
     }
     $prevLink = array();
     $nextLink = array();
     // construct prev & next link
     //get blog navigation object
     if ($config->get('layout_navigation')) {
         $blogNav = EasyBlogHelper::getBlogNavigation($blogId, $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: Mark notifications item in EasyDiscuss when the blog entry is viewed
     if ($config->get('integrations_easydiscuss_notification_blog')) {
         EasyBlogHelper::getHelper('EasyDiscuss')->readNotification($blog->id, EBLOG_NOTIFICATIONS_TYPE_BLOG);
     }
     if ($config->get('integrations_easydiscuss_notification_comment')) {
         EasyBlogHelper::getHelper('EasyDiscuss')->readNotification($blog->id, EBLOG_NOTIFICATIONS_TYPE_COMMENT);
     }
     if ($config->get('integrations_easydiscuss_notification_rating')) {
         EasyBlogHelper::getHelper('EasyDiscuss')->readNotification($blog->id, EBLOG_NOTIFICATIONS_TYPE_RATING);
     }
     //get social bookmark provider.
     require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'bookmark.php';
     $bookmark = EasyBlogBookmark::getHTML();
     // @task: As we are standardizing the admin tools, we fix the necessary properties here.
     $blog->isFeatured = $isFeatured;
     $theme->set('currentURL', EasyBlogRouter::_('index.php?option=com_easyblog&view=latest'));
     $theme->set('facebookLike', $facebookLike);
     $theme->set('notice', $notice);
     $theme->set('team', $team);
     $theme->set('blog', $blog);
     $theme->set('tags', $tags);
     $theme->set('blogger', $blogger);
     $theme->set('prevLink', $prevLink);
     $theme->set('nextLink', $nextLink);
     $theme->set('blogRelatedPost', $blogRelatedPost);
     $theme->set('authorRecentPosts', $authorRecentPosts);
     $theme->set('isFeatured', $isFeatured);
     $theme->set('isMineBlog', EasyBlogHelper::isMineBlog($blog->created_by, $my->id));
     $theme->set('acl', $acl);
     $theme->set('url', $url);
     $theme->set('commentHTML', $commentHtml);
     $theme->set('bookmark', $bookmark);
     $theme->set('pdfLinkProperties', EasyBlogHelper::getPDFlinkProperties());
     $theme->set('ispreview', false);
     // @task: trackbacks
     $trackbacks = $blogModel->getTrackback($blogId);
     $theme->set('trackbackURL', EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=trackback&post_id=' . $blog->id, true, true));
     $theme->set('trackbacks', $trackbacks);
     //google adsense
     $adsense = EasyBlogGoogleAdsense::getHTML($blogger->id);
     $blogHeader = $adsense->header;
     $blogFooter = $adsense->footer;
     $theme->set('adsenseHTML', $adsense->beforecomments);
     $blogHtml = $theme->fetch('blog.read' . EasyBlogHelper::getHelper('Sources')->getTemplateFile($blog->source) . '.php');
     echo $blogHeader;
     echo $blogHtml;
     echo $blogFooter;
 }
コード例 #7
0
ファイル: view.html.php プロジェクト: Tommar/vino2
 /**
  * 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');
 }
コード例 #8
0
ファイル: dashboard.php プロジェクト: Tommar/vino2
 /**
  * Allow current user to remove their own profile picture.
  *
  */
 public function removePicture()
 {
     $mainframe = JFactory::getApplication();
     $acl = EasyBlogACLHelper::getRuleSet();
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     if (!$config->get('layout_avatar') || !$acl->rules->upload_avatar) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_DELETE_PROFILE_PICTURE'), 'error');
         $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
         $mainframe->close();
     }
     JTable::addIncludePath(EBLOG_TABLES);
     $profile = EasyBlogHelper::getTable('Profile', 'Table');
     $profile->load($my->id);
     $avatar_config_path = $config->get('main_avatarpath');
     $avatar_config_path = rtrim($avatar_config_path, '/');
     $avatar_config_path = str_replace('/', DIRECTORY_SEPARATOR, $avatar_config_path);
     $path = JPATH_ROOT . DIRECTORY_SEPARATOR . $avatar_config_path . DIRECTORY_SEPARATOR . $profile->avatar;
     if (!JFile::delete($path)) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_DELETE_PROFILE_PICTURE'), 'error');
         $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
         $mainframe->close();
     }
     // @rule: Update avatar in database
     $profile->avatar = '';
     $profile->store();
     EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_PROFILE_PICTURE_REMOVED'));
     $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
     $mainframe->close();
 }
コード例 #9
0
ファイル: entry.php プロジェクト: Tommar/vino2
 /**
  * @since 3.0
  * Unsubscribe a user with email to a blog post
  *
  * @param	int		Subscription ID
  * @param	int		Blog post ID
  *
  * @return	bool	True on success
  */
 public function unsubscribe()
 {
     $subscriptionId = JRequest::getInt('subscription_id');
     $blogId = JRequest::getInt('blog_id');
     $my = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     $redirect = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blogId, false);
     // Check variables
     if ($my->id == 0 || !$subscriptionId || !$blogId) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error');
         $mainframe->redirect($redirect);
     }
     // Need to ensure that whatever id passed in is owned by the current browser
     $blogModel = EasyblogHelper::getModel('Blog');
     $sid = $blogModel->isBlogSubscribedUser($blogId, $my->id, $my->email);
     if ($subscriptionId != $sid) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error');
         $mainframe->redirect($redirect);
     }
     // Proceed to unsubscribe
     $table = EasyBlogHelper::getTable('Subscription', 'Table');
     $table->load($subscriptionId);
     if (!$table->delete()) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_UNSUBSCRIBE_BLOG_FAILED'), 'error');
         $mainframe->redirect($redirect);
     }
     EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_UNSUBSCRIBE_BLOG_SUCCESS'), 'success');
     $mainframe->redirect($redirect);
 }
コード例 #10
0
ファイル: view.ejax.php プロジェクト: Tommar/vino2
 public function confirmDeleteTag($ids, $url)
 {
     $my = JFactory::getUser();
     $ajax = new Ejax();
     $acl = EasyBlogACLHelper::getRuleSet();
     $config = EasyBlogHelper::getConfig();
     $ids = explode(',', $ids);
     if ($my->id == 0 || empty($acl->rules->create_tag)) {
         $options = new stdClass();
         $options->content = JText::_('COM_EASYBLOG_NOT_ALLOWED');
         $ajax->dialog($options);
         return $ajax->send();
     }
     // Need to ensure that whatever id passed in is owned by the current browser
     foreach ($ids as $id) {
         $tag = EasyBlogHelper::getTable('Tag', 'Table');
         $tag->load($id);
         if ($tag->created_by != $my->id && !EasyBlogHelper::isSiteAdmin()) {
             EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error');
             $mainframe->redirect(EasyBlogRouter::_($url, false));
             return;
         }
     }
     $themes = new CodeThemes('dashboard');
     $themes->set('id', implode(',', $ids));
     $themes->set('redirect', base64_encode($url));
     $options = new stdClass();
     $options->title = JText::_('COM_EASYBLOG_DASHBOARD_TAGS_DIALOG_CONFIRM_DELETE_TITLE');
     $options->content = $themes->fetch('ajax.dialog.tag.delete.php');
     $ajax->dialog($options);
     return $ajax->send();
 }
コード例 #11
0
ファイル: oauth.php プロジェクト: Tommar/vino2
 /**
  * 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);
 }