/** * Override functionality of JTable's hit method as we want to limit the hits based on the session. * **/ public function hit($pk = null) { $config = EasyBlogHelper::getConfig(); if ($config->get('main_hits_session')) { $ip = JRequest::getVar('REMOTE_ADDR', '', 'SERVER'); if (!empty($ip) && !empty($this->id)) { $token = md5($ip . $this->id); $session = JFactory::getSession(); $exists = $session->get($token, false); if ($exists) { return true; } $my = JFactory::getUser(); JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT); if ($my->id > 0 && EasyBlogHelper::isAUPEnabled()) { $aupid = AlphaUserPointsHelper::getAnyUserReferreID($my->id); AlphaUserPointsHelper::newpoints('plgaup_easyblog_read_blog', $aupid, '', JText::sprintf('COM_EASYBLOG_AUP_READ_BLOG', $this->title)); } // Deduct points from respective systems // @rule: Integrations with EasyDiscuss EasyBlogHelper::getHelper('EasyDiscuss')->log('easyblog.view.blog', $my->id, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_HISTORY_VIEW_BLOG', $this->title)); EasyBlogHelper::getHelper('EasyDiscuss')->addPoint('easyblog.view.blog', $my->id); EasyBlogHelper::getHelper('EasyDiscuss')->addBadge('easyblog.view.blog', $my->id); // Only give points if the viewer is viewing another person's blog post. if ($my->id != $this->created_by) { EasyBlogHelper::getHelper('EasySocial')->assignBadge('blog.read', JText::_('COM_EASYBLOG_EASYSOCIAL_BADGE_READ_BLOG')); } $session->set($token, 1); } } return parent::hit($pk); }