Example #1
0
 public function form($tpl = null)
 {
     JHTML::_('behavior.modal', 'a.modal');
     $feed = EasyBlogHelper::getTable('Feed', 'Table');
     JToolBarHelper::title(JText::_('COM_EASYBLOG_BLOGS_FEEDS_CREATE_NEW_TITLE'), 'feeds');
     JToolBarHelper::custom('save', 'save.png', 'save_f2.png', 'COM_EASYBLOG_SAVE', false);
     JToolbarHelper::cancel();
     $cid = JRequest::getVar('cid', '', 'REQUEST');
     if (!empty($cid)) {
         $feed->load($cid);
     }
     $post = JRequest::get('POST');
     if (!empty($post)) {
         $feed->bind($post);
     }
     $categoryName = '';
     $authorName = '';
     if (!empty($feed->item_category)) {
         $categoryName = $feed->getCategoryName();
     }
     if (!empty($feed->item_creator)) {
         $author = JFactory::getUser($feed->item_creator);
         $authorName = $author->name;
     }
     $params = EasyBlogHelper::getRegistry($feed->params);
     $this->assignRef('params', $params);
     $this->assignRef('feed', $feed);
     $this->assignRef('categoryName', $categoryName);
     $this->assignRef('authorName', $authorName);
     parent::display($tpl);
 }
Example #2
0
 /**
  * Adds a notification item in JomSocial
  *
  * @access	public
  * @param 	TableBlog	$blog 	The blog table.
  */
 public function addNotification($title, $type, $target, $author, $link)
 {
     jimport('joomla.filesystem.file');
     // @since this only works with JomSocial 2.6, we need to test certain files.
     $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'notificationtypes.php';
     if (!$this->exists || empty($target) || $target[0] == $author->getId() || !JFile::exists($file)) {
         return false;
     }
     CFactory::load('helpers', 'notificationtypes');
     CFactory::load('helpers', 'content');
     CFactory::load('libraries', 'notificationtypes');
     // @task: Set the necessary parameters first.
     $params = EasyBlogHelper::getRegistry('');
     $params->set('url', str_replace("administrator/", "", $author->getProfileLink()));
     // @task: Obtain model from jomsocial.
     $model = CFactory::getModel('Notification');
     // @task: Currently we are not using this, so we should just skip this.
     $requireAction = 0;
     if (!is_array($target)) {
         $target = array($target);
     }
     foreach ($target as $targetId) {
         JTable::addIncludePath(JPATH_ROOT . '/components/com_community/tables');
         $notification = JTable::getInstance('Notification', 'CTable');
         $notification->actor = $author->getId();
         $notification->target = $targetId;
         $notification->content = $title;
         $notification->created = EasyBlogHelper::getDate()->toMySQL();
         $notification->params = $params->toString();
         $notification->cmd_type = CNotificationTypesHelper::convertNotifId($type);
         $notification->type = 0;
         $notification->store();
     }
     return true;
 }
Example #3
0
 public function getLimit($key = 'listlength')
 {
     $app = JFactory::getApplication();
     $default = EasyBlogHelper::getJConfig()->get('list_limit');
     if ($app->isAdmin()) {
         return $default;
     }
     $menus = JFactory::getApplication()->getMenu();
     $menu = $menus->getActive();
     $limit = -2;
     if (is_object($menu)) {
         $params = EasyBlogHelper::getRegistry();
         $params->load($menu->params);
         $limit = $params->get('limit', '-2');
     }
     // if menu did not specify the limit, then we use easyblog setting.
     if ($limit == '-2') {
         // Use default configurations.
         $config = EasyBlogHelper::getConfig();
         // @rule: For compatibility between older versions
         if ($key == 'listlength') {
             $key = 'layout_listlength';
         } else {
             $key = 'layout_pagination_' . $key;
         }
         $limit = $config->get($key);
     }
     // Revert to joomla's pagination if configured to inherit from Joomla
     if ($limit == '0' || $limit == '-1' || $limit == '-2') {
         $limit = $default;
     }
     return $limit;
 }
Example #4
0
 function &getConfig()
 {
     static $config = null;
     if (is_null($config)) {
         $params =& $this->_getParams('config');
         $config = EasyBlogHelper::getRegistry($params);
     }
     return $config;
 }
Example #5
0
 /**
  * Class Constructor
  *
  * @since	3.7
  * @access	public
  */
 public function __construct($sel_theme = null)
 {
     $config = EasyBlogHelper::getConfig();
     $this->user_theme = $config->get('layout_theme');
     // Default theme
     $theme = 'default';
     if (empty($sel_theme)) {
         $theme = $config->get('layout_theme');
     } elseif ($sel_theme == 'dashboard') {
         $theme = $config->get('layout_dashboard_theme');
         $this->dashboard = true;
     }
     $this->_theme = $theme;
     $obj = new stdClass();
     $obj->config = EasyBlogHelper::getConfig();
     $obj->my = JFactory::getUser();
     $obj->admin = EasyBlogHelper::isSiteAdmin();
     $profile = EasyBlogHelper::getTable('Profile', 'Table');
     $profile->load($obj->my->id);
     $profile->setUser($obj->my);
     $obj->profile = $profile;
     $currentTheme = $this->_theme;
     if (JRequest::getVar('theme', '') != '') {
         $currentTheme = JRequest::getVar('theme');
     }
     // Legacy fix
     if ($currentTheme == 'hako - new') {
         $currentTheme = 'default';
     }
     // @rule: Set the necessary parameters here.
     $rawParams = EBLOG_THEMES . DIRECTORY_SEPARATOR . $currentTheme . DIRECTORY_SEPARATOR . 'config.xml';
     if (JFile::exists($rawParams) && !$this->dashboard) {
         $this->params = EasyBlogHelper::getRegistry();
         // @task: Now we bind the default params
         $defaultParams = EBLOG_THEMES . DIRECTORY_SEPARATOR . $currentTheme . DIRECTORY_SEPARATOR . 'config.ini';
         if (JFile::exists($defaultParams)) {
             $this->params->load(JFile::read($defaultParams));
         }
         $themeConfig = $this->_getThemeConfig($currentTheme);
         // @task: Now we override it with the user saved params
         if (!empty($themeConfig->params)) {
             $extendObj = EasyBlogHelper::getRegistry($themeConfig->params);
             EasyBlogRegistryHelper::extend($this->params, $extendObj);
         }
     }
     //is blogger mode flag
     $obj->isBloggerMode = EasyBlogRouter::isBloggerMode();
     $this->set('system', $obj);
     $this->acl = EasyBlogACLHelper::getRuleSet();
 }
Example #6
0
 public function getParams($theme)
 {
     static $param = false;
     if (!$param) {
         $ini = EBLOG_THEMES . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . 'config.ini';
         $manifest = EBLOG_THEMES . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . 'config.xml';
         $contents = JFile::read($ini);
         $param = EasyBlogHelper::getRegistry($contents);
         $themeConfig = EasyBlogHelper::getTable('Configs');
         $themeConfig->load($theme);
         // @rule: Overwrite with the settings from the database.
         if (!empty($themeConfig->params)) {
             $themeParam = EasyBlogHelper::getRegistry($themeConfig->params);
             EasyBlogHelper::getHelper('Registry')->extend($param, $themeParam);
         }
     }
     return $param;
 }
Example #7
0
 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;
 }
Example #8
0
 public function __construct($name = '', $contents = '', $manifestFile, $xpath = false)
 {
     $version = EasyBlogHelper::getJoomlaVersion();
     if ($version >= '3.0') {
         $this->form = new JForm($name);
         if ($xpath == 'params') {
             $xpath = 'config/fields';
         }
         $this->form->loadFile($manifestFile, true, $xpath);
         $themeConfig = EasyBlogHelper::getTable('Configs');
         $themeConfig->load($name);
         $themeParam = EasyBlogHelper::getRegistry($themeConfig->params);
         $registry = EasyBlogHelper::getRegistry($contents);
         $this->form->bind($registry->toArray());
     } else {
         $this->form = new JParameter($contents, $manifestFile);
         $themeConfig = EasyBlogHelper::getTable('Configs');
         $themeConfig->load($name);
         // @rule: Overwrite with the settings from the database.
         if (!empty($themeConfig->params)) {
             $this->form->bind($themeConfig->params);
         }
     }
 }
Example #9
0
 public function setAccess($access)
 {
     $access = EasyBlogHelper::getRegistry($access);
     $this->_access_token = $access->get('token');
     return true;
 }
Example #10
0
 /**
  * Displays a single latest blog entry.
  *
  * @since	3.5
  * @author	Mark Lee <*****@*****.**>
  */
 public function latest()
 {
     // Fetch the latest blog entry
     $model = $this->getModel('Blog');
     // Get the current active menu's properties.
     $app = JFactory::getApplication();
     $menu = $app->getMenu()->getActive();
     $inclusion = '';
     if (is_object($menu)) {
         $params = EasyBlogHelper::getRegistry($menu->params);
         $inclusion = EasyBlogHelper::getCategoryInclusion($params->get('inclusion'));
     }
     $items = $model->getBlogsBy('latest', 0, '', 1, EBLOG_FILTER_PUBLISHED, null, true, array(), false, false, true, array(), $inclusion);
     if (is_array($items) && !empty($items)) {
         JRequest::setVar('id', $items[0]->id);
         return $this->display();
     }
     echo JText::_('COM_EASYBLOG_NO_BLOG_ENTRY');
 }
Example #11
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 = EasyBlogHelper::getTable('Oauth', 'Table');
     $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 = EasyBlogHelper::getRegistry($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 = EasyBlogHelper::getRegistry('');
     $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);
     }
 }
Example #12
0
 /**
  * Retrieves a key value from the access token object.
  */
 public function getAccessTokenValue($key)
 {
     $param = EasyBlogHelper::getRegistry($this->access_token);
     return $param->get($key);
 }
Example #13
0
    /**
     * Retrieves the comment count for the specific blog
     *
     * @param	int	$blogId	The blog id.
     **/
    public static function getCommentCount($blog)
    {
        $blogId = $blog->id;
        $config = EasyBlogHelper::getConfig();
        // If multiple comments, we output a common link
        if ($config->get('main_comment_multiple')) {
            return false;
        }
        if ($config->get('comment_komento')) {
            $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . 'bootstrap.php';
            if (JFile::exists($file)) {
                require_once $file;
                $commentsModel = Komento::getModel('comments');
                $commentCount = $commentsModel->getCount('com_easyblog', $blog->id);
                return $commentCount;
            }
        }
        $easysocial = EasyBlogHelper::getHelper('EasySocial');
        if ($config->get('comment_easysocial') && $easysocial->exists()) {
            return $easysocial->getCommentCount($blog);
        }
        if ($config->get('comment_compojoom')) {
            $file = JPATH_ROOT . '/administrator/components/com_comment/plugin/com_easyblog/josc_com_easyblog.php';
            if (JFile::exists($file)) {
                require_once $file;
                return CommentEasyBlog::output($blog, array(), true);
            }
            $file = JPATH_ROOT . '/components/com_comment/helpers/utils.php';
            if (JFile::exists($file)) {
                JLoader::discover('ccommentHelper', JPATH_ROOT . '/components/com_comment/helpers');
                return ccommentHelperUtils::commentInit('com_easyblog', $blog);
            }
        }
        if ($config->get('intensedebate')) {
            return false;
        }
        if ($config->get('comment_disqus')) {
            static $disqus = false;
            if (!$disqus) {
                ob_start();
                ?>
					var disqus_shortname = '<?php 
                echo $config->get('comment_disqus_code');
                ?>
';
					(function () {
					var s = document.createElement('script'); s.async = true;
					s.type = 'text/javascript';
					s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
					(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
					}());
				<?php 
                $contents = ob_get_contents();
                ob_end_clean();
                JFactory::getDocument()->addScriptDeclaration($contents);
                $disqus = true;
            }
            $string = '<!-- Disqus -->';
            $string .= '<span class="discus-comment">';
            $string .= '<a href="' . EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blogId) . '#disqus_thread"><span>' . JText::_('COM_EASYBLOG_COMMENTS') . '</span></a>';
            $string .= '</span>';
            return $string;
            // return false;
        }
        if ($config->get('comment_livefyre')) {
            return false;
        }
        if ($config->get('comment_jomcomment')) {
            $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_jomcomment' . DIRECTORY_SEPARATOR . 'helper' . DIRECTORY_SEPARATOR . 'minimal.helper.php';
            jimport('joomla.filesystem.file');
            if (!JFile::exists($file)) {
                return false;
            }
            require_once $file;
            return jcCountComment($blogId, 'com_easyblog');
        }
        $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_jcomments' . DIRECTORY_SEPARATOR . 'jcomments.php';
        if ($config->get('comment_jcomments') && JFile::exists($file)) {
            $db = EasyBlogHelper::db();
            $query = 'SELECT COUNT(1) FROM ' . $db->nameQuote('#__jcomments') . ' ' . 'WHERE ' . $db->nameQuote('object_id') . '=' . $db->Quote($blogId) . ' ' . 'AND ' . $db->nameQuote('object_group') . '=' . $db->Quote('com_easyblog') . ' ' . 'AND ' . $db->nameQuote('published') . '=' . $db->Quote(1);
            $db->setQuery($query);
            $total = $db->loadResult();
            return $total;
        }
        if ($config->get('comment_rscomments')) {
            return false;
        }
        if ($config->get('comment_facebook')) {
            return false;
        }
        // @task: Let's allow the plugin to also trigger the comment count.
        $params = EasyBlogHelper::getRegistry();
        $result = EasyBlogHelper::triggerEvent('easyblog.commentCount', $blog, $params, 0);
        $count = trim(implode(" ", $result));
        if (!empty($count)) {
            return $count;
        }
        $db = EasyBlogHelper::db();
        $query = 'SELECT COUNT(1) FROM ' . $db->nameQuote('#__easyblog_comment') . ' WHERE ' . $db->nameQuote('post_id') . '=' . $db->Quote($blogId) . ' AND `published` = ' . $db->Quote('1');
        $db->setQuery($query);
        $count = $db->loadResult();
        return $count;
    }
Example #14
0
 function display($tpl = null)
 {
     // @rule: Test for user access if on 1.6 and above
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         if (!JFactory::getUser()->authorise('easyblog.manage.user', 'com_easyblog')) {
             JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             JFactory::getApplication()->close();
         }
     }
     //initialise variables
     $document = JFactory::getDocument();
     $mainframe = JFactory::getApplication();
     $config = EasyBlogHelper::getConfig();
     $id = JRequest::getInt('id');
     $blogger = EasyBlogHelper::getTable('Profile', 'Table');
     $blogger->load($id);
     $post = EasyBlogHelper::getSession('EASYBLOG_REGISTRATION_POST');
     $avatarIntegration = $config->get('layout_avatarIntegration', 'default');
     $user = JFactory::getUser($id);
     $isNew = $user->id == 0 ? true : false;
     if ($isNew && !empty($post)) {
         unset($post['id']);
         $pwd = $post['password'];
         unset($post['password']);
         unset($post['password2']);
         $user->bind($post);
         $post['password'] = $pwd;
         $blogger->bind($post);
     }
     jimport('joomla.html.pane');
     $feedburner = EasyBlogHelper::getTable('Feedburner', 'Table');
     $feedburner->load($id);
     JTable::addIncludePath(EBLOG_TABLES);
     //twitter
     $twitter = EasyBlogHelper::getTable('Oauth', 'Table');
     $twitter->loadByUser($user->id, EBLOG_OAUTH_TWITTER);
     //linkedin
     $linkedin = EasyBlogHelper::getTable('Oauth', 'Table');
     $linkedin->loadByUser($user->id, EBLOG_OAUTH_LINKEDIN);
     //facebook
     $facebook = EasyBlogHelper::getTable('Oauth', 'Table');
     $facebook->loadByUser($user->id, EBLOG_OAUTH_FACEBOOK);
     $adsense = EasyBlogHelper::getTable('Adsense', 'Table');
     $adsense->load($id);
     if ($isNew && !empty($post)) {
         $feedburner->url = $post['feedburner_url'];
         $twitter->message = $post['integrations_twitter_message'];
         $twitter->auto = $post['integrations_twitter_auto'];
         $linkedin->auto = $post['integrations_linkedin_auto'];
         $linkedin->private = isset($post['integrations_linkedin_private']) ? $post['integrations_linkedin_private'] : false;
         $facebook->auto = $post['integrations_facebook_auto'];
         $adsense->published = $post['adsense_published'];
         $adsense->code = $post['adsense_code'];
         $adsense->display = $post['adsense_display'];
     }
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         require_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_users' . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . 'user.php';
         $jUserModel = new UsersModelUser();
         $form = $jUserModel->getForm();
         $form->setValue('password', null);
         $form->setValue('password2', null);
         $this->assignRef('form', $form);
     }
     $joomla_date = EasyBlogHelper::getJoomlaVersion() <= '1.5' ? '%Y-%m-%d %H:%M:%S' : 'Y-m-d H:i:s';
     $editor = JFactory::getEditor($config->get('layout_editor', 'tinymce'));
     $userParams = $user->getParameters(true);
     $bloggerRawParams = $blogger->getParams();
     if (is_array($bloggerRawParams)) {
         $bloggerRawParams = '';
     }
     $bloggerParams = EasyBlogHelper::getRegistry($bloggerRawParams);
     $this->assignRef('bloggerParams', $bloggerParams);
     $this->assignRef('editor', $editor);
     $this->assignRef('dateFormat', $joomla_date);
     $this->assignRef('config', $config);
     $this->assignRef('pane', $pane);
     $this->assignRef('feedburner', $feedburner);
     $this->assignRef('adsense', $adsense);
     $this->assignRef('twitter', $twitter);
     $this->assignRef('facebook', $facebook);
     $this->assignRef('linkedin', $linkedin);
     $this->assignRef('blogger', $blogger);
     $this->assignRef('user', $user);
     $this->assignRef('isNew', $isNew);
     $this->assignRef('params', $userParams);
     $this->assignRef('avatarIntegration', $avatarIntegration);
     $this->assignRef('post', $post);
     parent::display($tpl);
 }
Example #15
0
?>
</a>

				<?php 
echo EasyBlogHelper::getHelper('AUP')->getPoints($blogger->id);
?>

				<?php 
echo EasyBlogHelper::getHelper('EasySocial')->getPoints($blogger->id);
?>

				<?php 
if ($system->config->get('main_google_profiles')) {
    ?>
				<?php 
    $params = EasyBlogHelper::getRegistry();
    $params->load($blogger->get('params'));
    $googleURL = $params->get('google_profile_url');
    if (!empty($googleURL) && $params->get('show_google_profile_url')) {
        ?>
					( <a href="<?php 
        echo $this->escape($googleURL);
        ?>
" rel="author" <?php 
        echo $params->get('show_google_profile_url') ? '' : 'style="display: none;"';
        ?>
><?php 
        echo JText::_('COM_EASYBLOG_VIEW_BLOGGER_ON_GOOGLE');
        ?>
</a> )
				<?php 
Example #16
0
 function simple($tmpl = null)
 {
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     $config = EasyBlogHelper::getConfig();
     // @task: Set meta tags for bloggers
     EasyBlogHelper::setMeta(META_ID_GATEGORIES, META_TYPE_VIEW);
     // @task: Set the pathway
     $pathway = $app->getPathway();
     if (!EasyBlogRouter::isCurrentActiveMenu('categories')) {
         $this->setPathway(JText::_('COM_EASYBLOG_CATEGORIES_BREADCRUMB'), '');
     }
     // @task: Get the sorting options.
     $sortConfig = $config->get('layout_sorting_category', 'latest');
     $sort = JRequest::getCmd('sort', $sortConfig);
     // @task: Retrieve models
     $categoriesModel = $this->getModel('Categories');
     $categoryModel = $this->getModel('Category');
     // @task: Test if there's any explicit inclusion of categories
     $menu = $app->getMenu()->getActive();
     $inclusion = '';
     if (is_object($menu) && stristr($menu->link, 'view=categories') !== false) {
         $params = EasyBlogHelper::getRegistry($menu->params);
         $inclusion = EasyBlogHelper::getCategoryInclusion($params->get('inclusion'));
     }
     $data = $categoriesModel->getCategoryTree($sort);
     if (!empty($data)) {
         for ($i = 0; $i < count($data); $i++) {
             $row =& $data[$i];
             // 				$row->childs = null;
             // 				EasyBlogHelper::buildNestedCategories($row->id, $row, false , true );
             $catIds = array();
             $catIds[] = $row->id;
             $row->cnt = $categoryModel->getTotalPostCount($catIds);
             $row->description = $row->get('description');
             // 				$row->rssLink   	= $row->getRSS();
             // 				$row->avatar    	= $row->getAvatar();
         }
     }
     // 		echo '<pre>';
     // 		print_r($data);
     // 		echo '</pre>';
     // 		exit;
     // @task: Set page title
     parent::setPageTitle(JText::_('COM_EASYBLOG_CATEGORIES_PAGE_TITLE'), '0', true);
     $theme = new CodeThemes();
     $theme->set('data', $data);
     $theme->set('sort', $sort);
     echo $theme->fetch('blog.categories.simple.php');
 }
Example #17
0
 /**
  * Responsible to display the front page of the blog listings
  *
  * @access	public
  */
 function display($tmpl = null)
 {
     // @task: Set meta tags for latest post
     EasyBlogHelper::setMeta(META_ID_LATEST, META_TYPE_VIEW);
     // @task: Set rss links into headers.
     EasyBlogHelper::getHelper('Feeds')->addHeaders('index.php?option=com_easyblog&view=latest');
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     $config = EasyBlogHelper::getConfig();
     $my = JFactory::getUser();
     $acl = EasyBlogACLHelper::getRuleSet();
     // @task: Add a breadcrumb if the current menu that's being accessed is not from the latest view.
     if (!EasyBlogRouter::isCurrentActiveMenu('latest')) {
         $this->setPathway(JText::_('COM_EASYBLOG_LATEST_BREADCRUMB'), '');
     }
     // @task: Get the current active menu's properties.
     $menu = $app->getMenu()->getActive();
     $menu = JFactory::getApplication()->getMenu()->getActive();
     $inclusion = '';
     if (is_object($menu)) {
         $params = EasyBlogHelper::getRegistry();
         $params->load($menu->params);
         $inclusion = EasyBlogHelper::getCategoryInclusion($params->get('inclusion'));
         if ($params->get('includesubcategories', 0) && !empty($inclusion)) {
             $tmpInclusion = array();
             foreach ($inclusion as $includeCatId) {
                 //get the nested categories
                 $category = new stdClass();
                 $category->id = $includeCatId;
                 $category->childs = null;
                 EasyBlogHelper::buildNestedCategories($category->id, $category);
                 $linkage = '';
                 EasyBlogHelper::accessNestedCategories($category, $linkage, '0', '', 'link', ', ');
                 $catIds = array();
                 $catIds[] = $category->id;
                 EasyBlogHelper::accessNestedCategoriesId($category, $catIds);
                 $tmpInclusion = array_merge($tmpInclusion, $catIds);
             }
             $inclusion = $tmpInclusion;
         }
     }
     // @task: Necessary filters
     $sort = JRequest::getCmd('sort', $config->get('layout_postorder'));
     $model = $this->getModel('Blog');
     // @task: Retrieve the list of featured blog posts.
     $featured = $model->getFeaturedBlog($inclusion);
     $excludeIds = array();
     // @task: Add canonical URLs.
     if ($config->get('main_canonical_entry')) {
         $canonicalUrl = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=latest', false, true, true);
         $doc->addCustomTag('<link rel="canonical" href="' . $canonicalUrl . '"/>');
     }
     // Test if user also wants the featured items to be appearing in the blog listings on the front page.
     // Otherwise, we'll need to exclude the featured id's from appearing on the front page.
     if (!$config->get('layout_featured_frontpage')) {
         foreach ($featured as $item) {
             $excludeIds[] = $item->id;
         }
     }
     // @task: Admin might want to display the featured blogs on all pages.
     if (!$config->get('layout_featured_allpages') && (JRequest::getInt('start', 0) != 0 || JRequest::getInt('limitstart', 0) != 0)) {
         $featured = array();
     } else {
         for ($i = 0; $i < count($featured); $i++) {
             $row = $featured[$i];
             $row->featuredImage = EasyBlogHelper::getFeaturedImage($row->intro . $row->content);
         }
         $featured = EasyBlogHelper::formatBlog($featured, true, false, false, false, false);
     }
     // @task: Try to retrieve any categories to be excluded.
     $excludedCategories = $config->get('layout_exclude_categories');
     $excludedCategories = empty($excludedCategories) ? '' : explode(',', $excludedCategories);
     // @task: Fetch the blog entries.
     $data = $model->getBlogsBy('', '', $sort, 0, EBLOG_FILTER_PUBLISHED, null, true, $excludeIds, false, false, true, $excludedCategories, $inclusion);
     $pagination = $model->getPagination();
     $params = $app->getParams('com_easyblog');
     // @task: Perform necessary formatting here.
     $data = EasyBlogHelper::formatBlog($data, true, true, true, true);
     // @task: Update the title of the page if navigating on different pages to avoid Google marking these title's as duplicates.
     $title = EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_LATEST_PAGE_TITLE'));
     // @task: Set the page title
     parent::setPageTitle($title, $pagination, $config->get('main_pagetitle_autoappend'));
     // @task: Get pagination output here.
     $paginationHTML = $pagination->getPagesLinks();
     $theme = new CodeThemes();
     $theme->set('data', $data);
     $theme->set('featured', $featured);
     $theme->set('currentURL', EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false));
     $theme->set('pagination', $paginationHTML);
     // @task: Send back response to the browser.
     echo $theme->fetch('blog.latest.php');
 }
Example #18
0
 public function save()
 {
     JRequest::checkToken() or die('Invalid Token');
     // @task: Check for acl rules.
     $this->checkAccess('theme');
     $element = JRequest::getVar('element');
     $params = JRequest::getVar('params');
     $obj = EasyBlogHelper::getRegistry('');
     foreach ($params as $key => $value) {
         $obj->set($key, $value);
     }
     if (EasyBlogHelper::getJoomlaVersion() >= '3.0') {
         // Update creation source.
         $creation = JRequest::getVar('creation_source');
         $obj->set('creation_source', $creation);
         // Update tags colour scheme.
         $tagColour = JRequest::getVar('tags_color_scheme');
         $obj->set('tags_color_scheme', $tagColour);
     }
     $this->updateBlogImage($element);
     // Store this value in the configs table.
     $table = EasyBlogHelper::getTable('Configs');
     $table->load($element);
     $table->set('name', $element);
     $table->set('params', $obj->toString('INI'));
     $table->store($element);
     $url = $this->getTask() == 'apply' ? 'index.php?option=com_easyblog&view=theme&element=' . $element : 'index.php?option=com_easyblog&view=themes';
     $this->setRedirect($url, JText::_('COM_EASYBLOG_THEME_SAVED_SUCCESSFULLY'), 'message');
 }
Example #19
0
 /**
  * Function to show user profile
  */
 function profile()
 {
     $mainframe = JFactory::getApplication();
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     if (!EasyBlogHelper::isLoggedIn()) {
         EasyBlogHelper::showLogin();
         return;
     }
     JHTML::_('behavior.formvalidation');
     $document = JFactory::getDocument();
     $title = EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_DASHBOARD_SETTINGS_PAGE_TITLE'));
     // @task: Set the page title
     parent::setPageTitle($title, false, $config->get('main_pagetitle_autoappend'));
     $pathway = $mainframe->getPathway();
     if (!EasyBlogRouter::isCurrentActiveMenu('dashboard')) {
         $pathway->addItem(JText::_('COM_EASYBLOG_DASHBOARD_BREADCRUMB'), EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard'));
     }
     $pathway->addItem(JText::_('COM_EASYBLOG_DASHBOARD_SETTINGS_BREADCRUMB'), '');
     $profile = EasyBlogHelper::getTable('Profile', 'Table');
     $profile->load($my->id);
     $editor = JFactory::getEditor($config->get('layout_editor'));
     $avatarIntegration = $config->get('layout_avatarIntegration', 'default');
     $user = EasyBlogHelper::getTable('Profile', 'Table');
     $user->load($my->id);
     //default blogger permalink to username if not found.
     if (empty($profile->permalink)) {
         $profile->permalink = $my->username;
     }
     $feedburner = EasyBlogHelper::getTable('Feedburner', 'Table');
     $feedburner->load($my->id);
     $adsense = EasyBlogHelper::getTable('Adsense', 'Table');
     $adsense->load($my->id);
     //get meta info for this blogger
     $model = $this->getModel('Metas');
     $meta = $model->getMetaInfo(META_TYPE_BLOGGER, $my->id);
     $twitter = EasyBlogHelper::getTable('Oauth', 'Table');
     $twitter->loadByUser($my->id, EBLOG_OAUTH_TWITTER);
     $linkedin = EasyBlogHelper::getTable('Oauth', 'Table');
     $linkedin->loadByUser($my->id, EBLOG_OAUTH_LINKEDIN);
     $facebook = EasyBlogHelper::getTable('Oauth', 'Table');
     $facebook->loadByUser($my->id, EBLOG_OAUTH_FACEBOOK);
     //multi blogger themes
     $userparams = EasyBlogHelper::getRegistry($profile->get('params'));
     $multithemes = new stdClass();
     $multithemes->enable = $config->get('layout_enablebloggertheme', true);
     if (!is_array($config->get('layout_availablebloggertheme'))) {
         $multithemes->availableThemes = explode('|', $config->get('layout_availablebloggertheme'));
     }
     $multithemes->selectedTheme = $userparams->get('theme', 'global');
     echo $this->showToolbar(__FUNCTION__, $user);
     // Add the breadcrumbs
     $breadcrumbs = array(JText::_('COM_EASYBLOG_DASHBOARD_BREADCRUMB_EDIT_PROFILE') => '');
     $editor = JFactory::getEditor($config->get('layout_editor'));
     $tpl = new CodeThemes('dashboard');
     $tpl->set('editor', $editor);
     $tpl->set('breadcrumbs', $breadcrumbs);
     $tpl->set('google_profile_url', $userparams->get('google_profile_url'));
     $tpl->set('show_google_profile_url', $userparams->get('show_google_profile_url'));
     $tpl->set('facebook', $facebook);
     $tpl->set('linkedin', $linkedin);
     $tpl->set('my', $my);
     $tpl->set('feedburner', $feedburner);
     $tpl->set('editor', $editor);
     $tpl->set('twitter', $twitter);
     $tpl->set('adsense', $adsense);
     $tpl->set('profile', $profile);
     $tpl->set('config', $config);
     $tpl->set('avatarIntegration', $avatarIntegration);
     $tpl->set('meta', $meta);
     $tpl->set('multithemes', $multithemes);
     echo $tpl->fetch('dashboard.profile.php');
 }
Example #20
0
 function saveProfile()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     $mainframe = JFactory::getApplication();
     $acl = EasyBlogACLHelper::getRuleSet();
     $post = JRequest::get('post');
     $config = EasyBlogHelper::getConfig();
     $my = JFactory::getUser();
     $this->checkLogin();
     if (EasyBlogHelper::isSiteAdmin() || $config->get('layout_dashboard_biography_editor')) {
         $post['description'] = JRequest::getVar('description', '', 'POST', '', JREQUEST_ALLOWRAW);
         $post['biography'] = JRequest::getVar('biography', '', 'POST', '', JREQUEST_ALLOWRAW);
         // 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])) {
             $post['description'] = $inputFilter->clean($post['description']);
             $post['biography'] = $inputFilter->clean($post['biography']);
         }
     }
     array_walk($post, array($this, '_trim'));
     if ($config->get('main_dashboard_editaccount')) {
         if (!$this->_validateProfileFields($post)) {
             $this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
             return;
         }
         $my->name = $post['fullname'];
         $my->save();
     }
     if ($config->get('main_joomlauserparams')) {
         $email = $post['email'];
         $password = $post['password'];
         $password2 = $post['password2'];
         if (JString::strlen($password) || JString::strlen($password2)) {
             if ($password != $password2) {
                 EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_DASHBOARD_ACCOUNT_PASSWORD_ERROR'), 'error');
                 $this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
                 return false;
             }
         }
         // Store basic Joomla information
         $user = JFactory::getUser();
         $data = array('email' => $email, 'password' => $password, 'password2' => $password2);
         $user->bind($data);
         if (!$user->save()) {
             EasyBlogHelper::setMessageQueue($user->getError(), 'error');
             $this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
             return false;
         }
         $session = JFactory::getSession();
         $session->set('user', $user);
         $table = JTable::getInstance('Session');
         $table->load($session->getId());
         $table->username = $user->get('username');
         $table->store();
     }
     $post['permalink'] = $post['user_permalink'];
     unset($post['user_permalink']);
     // Check if permalink exists.
     $model = EasyBlogHelper::getModel('Users');
     if ($model->permalinkExists($post['permalink'], $my->id)) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_DASHBOARD_ACCOUNT_PERMALINK_EXISTS'), 'error');
         $this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
         return false;
     }
     $profile = EasyBlogHelper::getTable('Profile', 'Table');
     $profile->load($my->id);
     $profile->bind($post);
     if ($config->get('main_feedburner') && $config->get('main_feedburnerblogger') && !empty($acl->rules->allow_feedburner)) {
         $feedburner = EasyBlogHelper::getTable('Feedburner', 'Table');
         $feedburner->load($my->id);
         $feedburner->url = $post['feedburner_url'];
         $feedburner->store();
     }
     JTable::addIncludePath(EBLOG_TABLES);
     if (!empty($acl->rules->update_twitter)) {
         $mainframe = JFactory::getApplication();
         $twitter = EasyBlogHelper::getTable('Oauth', 'Table');
         $twitter->loadByUser($my->id, EBLOG_OAUTH_TWITTER);
         $twitter->auto = JRequest::getVar('integrations_twitter_auto');
         $twitter->message = JRequest::getVar('integrations_twitter_message');
         if (!$twitter->store()) {
             EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_INTEGRATIONS_TWITTER_ERROR'), 'error');
         }
     }
     // Map linkedin items
     if (!empty($acl->rules->update_linkedin)) {
         $mainframe = JFactory::getApplication();
         $linkedin = EasyBlogHelper::getTable('Oauth', 'Table');
         $linkedin->loadByUser($my->id, EBLOG_OAUTH_LINKEDIN);
         $linkedin->auto = JRequest::getVar('integrations_linkedin_auto');
         $linkedin->message = JRequest::getVar('integrations_linkedin_message');
         $linkedin->private = JRequest::getVar('integrations_linkedin_private');
         if (!$linkedin->store()) {
             EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_INTEGRATIONS_LINKEDIN_ERROR'), 'error');
         }
     }
     if (!empty($acl->rules->update_facebook)) {
         $mainframe = JFactory::getApplication();
         $facebook = EasyBlogHelper::getTable('Oauth', 'Table');
         $facebook->loadByUser($my->id, EBLOG_OAUTH_FACEBOOK);
         $facebook->auto = JRequest::getVar('integrations_facebook_auto');
         $facebook->message = '';
         if (!$facebook->store()) {
             EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_INTEGRATIONS_FACEBOOK_FAILED_UPDATE_INFO_ERROR'), 'error');
         }
     }
     $this->saveAdsenseUserParams();
     //save avatar
     if (!empty($acl->rules->upload_avatar)) {
         $file = JRequest::getVar('Filedata', '', 'files', 'array');
         if (!empty($file['name'])) {
             $newAvatar = $this->_upload($profile);
             $profile->avatar = $newAvatar;
             // AlphaUserPoints
             // since 1.2
             if (EasyBlogHelper::isAUPEnabled()) {
                 AlphaUserPointsHelper::newpoints('plgaup_easyblog_upload_avatar', '', 'easyblog_upload_avatar_' . $my->id, JText::_('COM_EASYBLOG_AUP_UPLOADED_AVATAR'));
             }
         }
     }
     //save meta
     if (!empty($acl->rules->add_entry)) {
         //meta post info
         $metaId = JRequest::getInt('metaid', 0);
         $metapost = array();
         $metapost['keywords'] = JRequest::getVar('metakeywords', '');
         $metapost['description'] = JRequest::getVar('metadescription', '');
         $metapost['content_id'] = $my->id;
         $metapost['type'] = META_TYPE_BLOGGER;
         $meta = EasyBlogHelper::getTable('Meta', 'Table');
         $meta->load($metaId);
         $meta->bind($metapost);
         $meta->store();
     }
     //save params
     $userparams = EasyBlogHelper::getRegistry('');
     $userparams->set('theme', $post['theme']);
     // @rule: Save google profile url
     if (isset($post['google_profile_url'])) {
         $userparams->set('google_profile_url', $post['google_profile_url']);
     }
     if (isset($post['show_google_profile_url'])) {
         $userparams->set('show_google_profile_url', $post['show_google_profile_url']);
     }
     $profile->params = $userparams->toString();
     if ($config->get('main_dashboard_editaccount') && $config->get('main_joomlauserparams')) {
         $my->save(true);
     }
     if ($profile->store()) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_DASHBOARD_PROFILE_UPDATE_SUCCESS'), 'info');
     } else {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_DASHBOARD_PROFILE_UPDATE_FAILED'), 'error');
     }
     $this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
 }
Example #21
0
 public static function getBloggerTheme()
 {
     $id = EasyBlogRouter::isBloggerMode();
     if (empty($id)) {
         return false;
     }
     $profile = EasyBlogHelper::getTable('Profile', 'Table');
     $profile->load($id);
     $userparams = EasyBlogHelper::getRegistry($profile->params);
     return $userparams->get('theme', false);
 }
Example #22
0
 public function processTwitter()
 {
     // @rule: Find all oauth accounts
     $db = EasyBlogHelper::db();
     $config = EasyBlogHelper::getConfig();
     $key = $config->get('integrations_twitter_api_key');
     $secret = $config->get('integrations_twitter_secret_key');
     $query = 'SELECT * FROM ' . $db->nameQuote('#__easyblog_oauth');
     $query .= ' WHERE ' . $db->nameQuote('type') . '=' . $db->Quote('twitter');
     $query .= ' AND ' . $db->nameQuote('system') . '=' . $db->Quote(0);
     $db->setQuery($query);
     $accounts = $db->loadObjectList();
     $hashes = $config->get('integrations_twitter_microblog_hashes');
     // If hashes are empty, do not try to run anything since we wouldn't be able to find anything.
     if (empty($hashes)) {
         return false;
     }
     $hashes = explode(',', $hashes);
     $totalHashes = count($hashes);
     $search = '';
     $categoryId = $config->get('integrations_twitter_microblog_category');
     $published = $config->get('integrations_twitter_microblog_publish');
     $frontpage = $config->get('integrations_twitter_microblog_frontpage');
     // Build the hash queries
     for ($i = 0; $i < $totalHashes; $i++) {
         $search .= $hashes[$i];
         if (next($hashes) !== false) {
             $search .= ' OR ';
         }
     }
     $total = 0;
     if ($accounts) {
         foreach ($accounts as $account) {
             $query = 'SELECT `id_str` FROM ' . $db->nameQuote('#__easyblog_twitter_microblog') . ' ' . 'WHERE ' . $db->nameQuote('oauth_id') . '=' . $db->Quote($account->id) . ' ' . 'ORDER BY `created` DESC';
             $db->setQuery($query);
             $result = $db->loadObject();
             $jparam = EasyBlogHelper::getRegistry($account->params);
             $screen = $jparam->get('screen_name');
             // If we can't get the screen name, do not try to process it.
             if (!$screen) {
                 continue;
             }
             // @rule: Retrieve the consumer object for this oauth client.
             $consumer = EasyBlogHelper::getHelper('Oauth')->getConsumer('twitter', $key, $secret, '');
             $consumer->setAccess($account->access_token);
             $params = array('q' => $search . ' from:@' . $screen, 'showuser' => true);
             if ($result) {
                 $params['since_id'] = $result->id_str;
             }
             $data = $consumer->get('search/tweets', $params);
             $tweets = isset($data->statuses) ? $data->statuses : '';
             if ($tweets) {
                 foreach ($tweets as $tweet) {
                     // Ensure that the source of the author is the same as the user on site.
                     if ($tweet->user->screen_name != $screen) {
                         return;
                     }
                     // Remove hashtag from the content since it would be pointless to show it.
                     $tweet->text = str_ireplace($hashes, '', $tweet->text);
                     $blog = EasyBlogHelper::getTable('Blog');
                     $title = JString::substr($tweet->text, 0, 20) . '...';
                     $created = EasyBlogHelper::getDate($tweet->created_at);
                     $createdDate = $created->toMySQL();
                     $content = $tweet->text;
                     // @task: Store the blog post
                     $blog->set('title', $title);
                     $blog->set('source', 'twitter');
                     $blog->set('created_by', $account->user_id);
                     $blog->set('created', $createdDate);
                     $blog->set('modified', $createdDate);
                     $blog->set('publish_up', $createdDate);
                     $blog->set('intro', $content);
                     $blog->set('category_id', $categoryId);
                     $blog->set('published', $published);
                     $blog->set('frontpage', $frontpage);
                     $blog->set('issitewide', true);
                     $blog->set('source', EBLOG_MICROBLOG_TWITTER);
                     // Store the blog post
                     if (!$blog->store()) {
                         var_dump($blog->getError());
                     }
                     // @task: Add a history item
                     $history = EasyBlogHelper::getTable('TwitterMicroBlog', 'Table');
                     $history->set('id_str', $tweet->id_str);
                     $history->set('post_id', $blog->id);
                     $history->set('oauth_id', $account->id);
                     $history->set('created', $createdDate);
                     $history->set('tweet_author', $screen);
                     $history->store();
                     $total++;
                 }
             }
         }
     }
     echo JText::sprintf('%1s blog posts fetched from Twitter', $total);
 }
Example #23
0
 public function grant()
 {
     // @task: Check for acl rules.
     $this->checkAccess('autoposting');
     $type = JRequest::getCmd('type');
     $mainframe = JFactory::getApplication();
     $config = EasyBlogHelper::getConfig();
     $key = $config->get('integrations_' . $type . '_api_key');
     $secret = $config->get('integrations_' . $type . '_secret_key');
     $my = JFactory::getUser();
     $from = JRequest::getWord('return');
     $oauth = EasyBlogHelper::getTable('Oauth');
     $loaded = $oauth->loadSystemByType($type);
     $denied = JRequest::getVar('denied', '');
     $redirect = JRoute::_('index.php?option=com_easyblog&view=autoposting&layout=' . $type . '&step=2', false);
     if ($from == 'form') {
         $redirect = JRoute::_('index.php?option=com_easyblog&view=autoposting&layout=form&type=' . $type, false);
     }
     $call = JRequest::getWord('call');
     $callUri = !empty($call) ? '&call=' . $call : '';
     if (!empty($denied)) {
         $oauth->delete();
         $this->setRedirect($redirect, JText::sprintf('Denied by %1s', $type), 'error');
         return;
     }
     if (!$loaded) {
         $oauth->delete();
         JError::raiseError(500, JText::_('COM_EASYBLOG_AUTOPOST_ERRORS_REQUEST_TOKENS_NOT_LOADED'));
     }
     $request = EasyBlogHelper::getRegistry($oauth->request_token);
     $return = JRequest::getWord('return');
     $return = !empty($return) ? '&return=' . $return : '';
     $callback = rtrim(JURI::root(), '/') . '/administrator/index.php?option=com_easyblog&c=autoposting&task=grant&type=' . $type . $return . $callUri;
     $consumer = EasyBlogHelper::getHelper('OAuth')->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_AUTOPOST_ERRORS_INVALID_VERIFIER'));
     }
     $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();
         $this->setRedirect($redirect, JText::sprintf('COM_EASYBLOG_AUTOPOST_ERRORS_INVALID_ACCESS_TOKENS', $type), 'error');
         return;
     }
     $param = EasyBlogHelper::getRegistry('');
     $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();
     // @task: Let's see if the oauth client
     if (!empty($call)) {
         $consumer->{$call}();
     } else {
         $this->setRedirect($redirect, JText::_('COM_EASYBLOG_AUTOPOST_ACCOUNT_ASSOCIATED_SUCCESSFULLY'));
     }
     return;
 }
Example #24
0
 public function setAccess($access)
 {
     $access = EasyBlogHelper::getRegistry($access);
     $this->token = new OAuthConsumer($access->get('token'), $access->get('secret'));
     return $this->token;
 }
Example #25
0
 public static function getItemIdByEntry($blogId)
 {
     static $entriesItems = null;
     if (!isset($entriesItems[$blogId])) {
         $db = EasyBlogHelper::db();
         // We need to check against the correct latest entry to be used based on the category this article is in
         $query = 'SELECT ' . EasyBlogHelper::getHelper('SQL')->nameQuote('id') . ',' . EasyBlogHelper::getHelper('SQL')->nameQuote('params') . ' FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__menu') . 'WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('link') . '=' . $db->Quote('index.php?option=com_easyblog&view=latest') . 'AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('published') . '=' . $db->Quote('1') . self::getLanguageQuery();
         $db->setQuery($query);
         $menus = $db->loadObjectList();
         $blog = EasyBlogHelper::getTable('Blog');
         $blog->load($blogId);
         if ($menus) {
             foreach ($menus as $menu) {
                 $params = EasyBlogHelper::getRegistry($menu->params);
                 $inclusion = EasyBlogHelper::getCategoryInclusion($params->get('inclusion'));
                 if (empty($inclusion)) {
                     continue;
                 }
                 if (!is_array($inclusion)) {
                     $inclusion = array($inclusion);
                 }
                 if (in_array($blog->category_id, $inclusion)) {
                     $entriesItems[$blogId] = $menu->id;
                 }
             }
         }
         // Test if there is any entry specific view as this will always override the latest above.
         $query = 'SELECT ' . EasyBlogHelper::getHelper('SQL')->nameQuote('id') . ' FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__menu') . ' ' . 'WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('link') . '=' . $db->Quote('index.php?option=com_easyblog&view=entry&id=' . $blogId) . ' ' . 'AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('published') . '=' . $db->Quote('1') . self::getLanguageQuery() . ' LIMIT 1';
         $db->setQuery($query);
         $itemid = $db->loadResult();
         if ($itemid) {
             $entriesItems[$blogId] = $itemid;
         } else {
             return '';
         }
     }
     return $entriesItems[$blogId];
 }
Example #26
0
 function save()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // @task: Check for acl rules.
     $this->checkAccess('user');
     $mainframe = JFactory::getApplication();
     $db = EasyBlogHelper::db();
     $my = JFactory::getUser();
     $acl = JFactory::getACL();
     $config = EasyBlogHelper::getConfig();
     // Create a new JUser object
     $user = JFactory::getUser(JRequest::getVar('id', 0, 'post', 'int'));
     $original_gid = $user->get('gid');
     $post = JRequest::get('post');
     $post['username'] = JRequest::getVar('username', '', 'post', 'username');
     $post['password'] = JRequest::getVar('password', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $post['password2'] = JRequest::getVar('password2', '', 'post', 'string', JREQUEST_ALLOWRAW);
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         $jformPost = JRequest::getVar('jform', array(), 'post', 'array');
         $post['params'] = $jformPost['params'];
     }
     if (!$user->bind($post)) {
         EasyBlogHelper::storeSession($post, 'EASYBLOG_REGISTRATION_POST');
         $mainframe->enqueueMessage($user->getError(), 'error');
         $this->_saveError($user->id);
     }
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         if ($user->get('id') == $my->get('id') && $user->get('block') == 1) {
             $mainframe->enqueueMessage(JText::_('You cannot block Yourself!'), 'error');
             $this->_saveError($user->id);
         } else {
             if ($user->authorise('core.admin') && $user->get('block') == 1) {
                 $mainframe->enqueueMessage(JText::_('You cannot block a Super User'), 'error');
                 $this->_saveError($user->id);
             } else {
                 if ($user->authorise('core.admin') && !$my->authorise('core.admin')) {
                     $mainframe->enqueueMessage(JText::_('You cannot edit a Super User account'), 'message');
                     $this->_saveError($user->id);
                 }
             }
         }
         //replacing thr group name with group id so it is save correctly into the Joomla group table.
         $jformPost = JRequest::getVar('jform', array(), 'post', 'array');
         if (!empty($jformPost['groups'])) {
             $user->groups = array();
             foreach ($jformPost['groups'] as $groupid) {
                 $user->groups[$groupid] = $groupid;
             }
         }
     } else {
         $objectID = $acl->get_object_id('users', $user->get('id'), 'ARO');
         $groups = $acl->get_object_groups($objectID, 'ARO');
         $this_group = strtolower($acl->get_group_name($groups[0], 'ARO'));
         if ($user->get('id') == $my->get('id') && $user->get('block') == 1) {
             $mainframe->enqueueMessage(JText::_('You cannot block Yourself!'), 'error');
             $this->_saveError($user->id);
         } else {
             if ($this_group == 'super administrator' && $user->get('block') == 1) {
                 $mainframe->enqueueMessage(JText::_('You cannot block a Super Administrator'), 'error');
                 $this->_saveError($user->id);
             } else {
                 if ($this_group == 'administrator' && $my->get('gid') == 24 && $user->get('block') == 1) {
                     $mainframe->enqueueMessage(JText::_('WARNBLOCK'), 'error');
                     $this->_saveError($user->id);
                 } else {
                     if ($this_group == 'super administrator' && $my->get('gid') != 25) {
                         $mainframe->enqueueMessage(JText::_('You cannot edit a super administrator account'), 'message');
                         $this->_saveError($user->id);
                     }
                 }
             }
         }
     }
     // Are we dealing with a new user which we need to create?
     $isNew = $user->get('id') < 1;
     if (EasyBlogHelper::getJoomlaVersion() <= '1.5') {
         // do this step only for J1.5
         if (!$isNew) {
             // if group has been changed and where original group was a Super Admin
             if ($user->get('gid') != $original_gid && $original_gid == 25) {
                 // count number of active super admins
                 $query = 'SELECT COUNT( id )' . ' FROM #__users' . ' WHERE gid = 25' . ' AND block = 0';
                 $db->setQuery($query);
                 $count = $db->loadResult();
                 if ($count <= 1) {
                     // disallow change if only one Super Admin exists
                     $this->setRedirect('index.php?option=com_users', JText::_('WARN_ONLY_SUPER'));
                     return false;
                 }
             }
         }
     }
     if (!$user->save()) {
         $mainframe->enqueueMessage($user->getError(), 'error');
         return $this->execute('edit');
     }
     // If updating self, load the new user object into the session
     if (EasyBlogHelper::getJoomlaVersion() <= '1.5') {
         if ($user->get('id') == $my->get('id')) {
             // Get an ACL object
             $acl = JFactory::getACL();
             // Get the user group from the ACL
             $grp = $acl->getAroGroup($user->get('id'));
             // Mark the user as logged in
             $user->set('guest', 0);
             $user->set('aid', 1);
             // Fudge Authors, Editors, Publishers and Super Administrators into the special access group
             if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) {
                 $user->set('aid', 2);
             }
             // Set the usertype based on the ACL group name
             $user->set('usertype', $grp->name);
             $session = JFactory::getSession();
             $session->set('user', $user);
         }
     } else {
         // Update session data if the current user was updated
         if ($user->get('id') == $my->get('id')) {
             $session = JFactory::getSession();
             $session->set('user', $user);
             // Force load from database
         }
     }
     $post = JRequest::get('post');
     if ($isNew) {
         unset($post['id']);
     }
     $post['permalink'] = $post['user_permalink'];
     unset($post['user_permalink']);
     if (EasyBlogHelper::isSiteAdmin()) {
         $post['description'] = JRequest::getVar('description', '', 'POST', '', JREQUEST_ALLOWRAW);
         $post['biography'] = JRequest::getVar('biography', '', 'POST', '', JREQUEST_ALLOWRAW);
     }
     $blogger = EasyBlogHelper::getTable('Profile', 'Table');
     $blogger->load($user->id);
     $blogger->bind($post);
     $file = JRequest::getVar('Filedata', '', 'Files', 'array');
     if (!empty($file['name'])) {
         $newAvatar = EasyBlogHelper::uploadAvatar($blogger, true);
         $blogger->avatar = $newAvatar;
     }
     //save params
     $userparams = EasyBlogHelper::getRegistry('');
     // @rule: Save google profile url
     if (isset($post['google_profile_url'])) {
         $userparams->set('google_profile_url', $post['google_profile_url']);
     }
     if (isset($post['show_google_profile_url'])) {
         $userparams->set('show_google_profile_url', $post['show_google_profile_url']);
     }
     $blogger->params = $userparams->toString();
     $blogger->store();
     JTable::addIncludePath(EBLOG_TABLES);
     //save twitter info.
     $twitter = EasyBlogHelper::getTable('Oauth', 'Table');
     $twitter->loadByUser($user->id, EBLOG_OAUTH_TWITTER);
     $twitter->auto = JRequest::getVar('integrations_twitter_auto');
     $twitter->message = JRequest::getVar('integrations_twitter_message');
     if (!$twitter->store()) {
         $mainframe->enqueueMessage(JText::_('COM_EASYBLOG_INTEGRATIONS_TWITTER_ERROR'), 'error');
     }
     // Map linkedin items
     $linkedin = EasyBlogHelper::getTable('Oauth', 'Table');
     $linkedin->loadByUser($user->id, EBLOG_OAUTH_LINKEDIN);
     $linkedin->auto = JRequest::getVar('integrations_linkedin_auto');
     $linkedin->message = JRequest::getVar('integrations_linkedin_message');
     $linkedin->private = JRequest::getVar('integrations_linkedin_private');
     if (!$linkedin->store()) {
         $mainframe->enqueueMessage(JText::_('COM_EASYBLOG_INTEGRATIONS_LINKEDIN_ERROR'), 'error');
     }
     // store faebook info
     $facebook = EasyBlogHelper::getTable('Oauth', 'Table');
     $facebook->loadByUser($user->id, EBLOG_OAUTH_FACEBOOK);
     $facebook->auto = JRequest::getVar('integrations_facebook_auto');
     $facebook->message = '';
     if (!$facebook->store()) {
         $mainframe->enqueueMessage(JText::_('COM_EASYBLOG_INTEGRATIONS_FACEBOOK_FAILED_UPDATE_INFO_ERROR'), 'error');
     }
     if ($config->get('integration_google_adsense_enable')) {
         // Store adsense data
         $adsense = EasyBlogHelper::getTable('Adsense', 'Table');
         $adsense->load($user->id);
         $adsense->code = $post['adsense_code'];
         $adsense->display = $post['adsense_display'];
         $adsense->published = $post['adsense_published'];
         $adsense->store();
     }
     // Store feedburner data
     $feedburner = EasyBlogHelper::getTable('Feedburner', 'Table');
     $feedburner->load($user->id);
     $feedburner->url = $post['feedburner_url'];
     $feedburner->store();
     $this->_saveSuccess($user->id);
 }
Example #27
0
 public static function getLink($type, $id)
 {
     if (empty($type) || empty($id)) {
         return false;
     }
     //prevent jtable is not loading incase overwritten by other component.
     JTable::addIncludePath(EBLOG_TABLES);
     $oauth = EasyBlogHelper::getTable('Oauth', 'Table');
     $oauth->loadByUser($id, $type);
     $param = EasyBlogHelper::getRegistry();
     $param->load($oauth->params);
     $screenName = $param->get('screen_name', '');
     $acl = EasyBlogACLHelper::getRuleSet($id);
     $rule = 'update_' . $type;
     if (!$acl->rules->{$rule}) {
         return false;
     }
     switch ($type) {
         case 'twitter':
             $link = empty($screenName) ? '' : 'http://twitter.com/' . $screenName;
             break;
         case 'facebook':
             $link = '';
             break;
         case 'linkedin':
             $link = '';
             break;
     }
     return $link;
 }
Example #28
0
 public function setAccess($access)
 {
     $access = EasyBlogHelper::getRegistry($access);
     return parent::setTokenAccess(array('oauth_token' => $access->get('token'), 'oauth_token_secret' => $access->get('secret')));
 }
Example #29
0
 function import($feedObj, $maxItems = 0)
 {
     jimport('simplepie.simplepie');
     $config = EasyBlogHelper::getConfig();
     $itemMigrated = 0;
     $isDomSupported = false;
     $defaultAllowedHTML = '<img>,<a>,<br>,<table>,<tbody>,<th>,<tr>,<td>,<div>,<span>,<p>,<h1>,<h2>,<h3>,<h4>,<h5>,<h6>';
     if (class_exists('DomDocument')) {
         $isDomSupported = true;
         require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'readability' . DIRECTORY_SEPARATOR . 'Readability.php';
     }
     $params = EasyBlogHelper::getRegistry($feedObj->params);
     $maxItems = $maxItems ? $maxItems : $params->get('feedamount', 0);
     $feedURL = $feedObj->url;
     require_once EBLOG_HELPERS . DIRECTORY_SEPARATOR . 'connectors.php';
     $connector = new EasyBlogConnectorsHelper();
     $connector->addUrl($feedURL);
     $connector->execute();
     $content = $connector->getResult($feedURL);
     // to ensure the leading no text before the <?xml> tag
     //$pattern	= '/(.*?)(?=<\?xml)/ims';
     $pattern = '/(.*?)<\\?xml version/is';
     $replacement = '<?xml version';
     $content = preg_replace($pattern, $replacement, $content, 1);
     if (strpos($content, '<?xml version') === false) {
         // look like the content missing the xml header. lets manually add in.
         $content = '<?xml version="1.0" encoding="utf-8"?>' . $content;
     }
     $parser = new SimplePie();
     $parser->strip_htmltags(false);
     $parser->set_raw_data($content);
     $parser->init();
     $items = '';
     $items = $parser->get_items();
     if (count($items) > 0) {
         //lets process the data insert
         $myCnt = 0;
         foreach ($items as $item) {
             @ini_set('max_execution_time', 180);
             if (!empty($maxItems) && $myCnt == $maxItems) {
                 break;
             }
             $timezoneSec = $item->get_date('Z');
             $itemdate = $item->get_date('U');
             $itemdate = $itemdate - $timezoneSec;
             $mydate = date('Y-m-d H:i:s', $itemdate);
             $feedUid = $item->get_id();
             $feedPath = $item->get_link();
             $feedHistory = EasyBlogHelper::getTable('FeedHistory');
             $newHistoryId = '';
             if ($feedHistory->isExists($feedObj->id, $feedUid)) {
                 continue;
             } else {
                 //log the feed item so that in future it will not process again.
                 $date = EasyBlogHelper::getDate();
                 $newHistory = EasyBlogHelper::getTable('FeedHistory');
                 $newHistory->feed_id = $feedObj->id;
                 $newHistory->uid = $feedUid;
                 $newHistory->created = $date->toMySQL();
                 $newHistory->store();
                 $newHistoryId = $newHistory->id;
             }
             $blogObj = new stdClass();
             // set the default setting from the feed configuration via backend.
             $blogObj->category_id = $feedObj->item_category;
             $blogObj->published = $feedObj->item_published;
             $blogObj->frontpage = $feedObj->item_frontpage;
             $blogObj->created_by = $feedObj->item_creator;
             $blogObj->allowcomment = $config->get('main_comment', 1);
             $blogObj->subscription = $config->get('main_subscription', 1);
             $blogObj->issitewide = '1';
             $text = $item->get_content();
             // @rule: Append copyright text
             $blogObj->copyrights = $params->get('copyrights', '');
             if ($feedObj->item_get_fulltext && $isDomSupported) {
                 $feedItemUrl = urldecode($item->get_link());
                 $fiConnector = new EasyBlogConnectorsHelper();
                 $fiConnector->addUrl($feedItemUrl);
                 $fiConnector->execute();
                 $fiContent = $fiConnector->getResult($feedItemUrl);
                 // to ensure the leading no text before the <?xml> tag
                 $pattern = '/(.*?)<html/is';
                 $replacement = '<html';
                 $fiContent = preg_replace($pattern, $replacement, $fiContent, 1);
                 if (!empty($fiContent)) {
                     $fiContent = EasyBlogHelper::getHelper('string')->forceUTF8($fiContent);
                     $readability = new Readability($fiContent);
                     $readability->debug = false;
                     $readability->convertLinksToFootnotes = false;
                     $result = $readability->init();
                     if ($result) {
                         $content = $readability->getContent()->innerHTML;
                         //$content	= EasyBlogHelper::getHelper( 'string' )->fixUTF8( $content );
                         $content = EasyBlogFeedsHelper::tidyContent($content);
                         if (stristr(html_entity_decode($content), '<!DOCTYPE html') === false) {
                             $text = $content;
                             $text = $this->_processRelLinktoAbs($text, $feedPath);
                         }
                     }
                 }
             }
             // strip un-allowed html tag.
             $text = strip_tags($text, $params->get('allowed', $defaultAllowedHTML));
             // Append original source link into article if necessary
             if ($params->get('sourceLinks')) {
                 JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
                 $text .= '<div><a href="' . $item->get_link() . '" target="_blank">' . JText::_('COM_EASYBLOG_FEEDS_ORIGINAL_LINK') . '</a></div>';
             }
             if ($feedObj->author) {
                 $feedAuthor = $item->get_author();
                 if (!empty($feedAuthor)) {
                     $authorName = $feedAuthor->get_name();
                     $authorEmail = $feedAuthor->get_email();
                     if (!empty($authorName)) {
                         // Store it as copyright column instead
                         $text .= '<div>' . JText::sprintf('COM_EASYBLOG_FEEDS_ORIGINAL_AUTHOR', $authorName) . '</div>';
                     } else {
                         if (!empty($authorEmail)) {
                             $authorArr = explode(' ', $authorEmail);
                             if (isset($authorArr[1])) {
                                 $authorName = $authorArr[1];
                                 $authorName = str_replace(array('(', ')'), '', $authorName);
                                 $text .= '<div>' . JText::sprintf('COM_EASYBLOG_FEEDS_ORIGINAL_AUTHOR', $authorName) . '</div>';
                             }
                         }
                     }
                 }
             }
             if ($feedObj->item_content == 'intro') {
                 $blogObj->intro = $text;
             } else {
                 $blogObj->content = $text;
             }
             $creationDate = $mydate;
             $blogObj->created = $mydate;
             $blogObj->modified = $mydate;
             $blogObj->title = $item->get_title();
             if (empty($blogObj->title)) {
                 $blogObj->title = $this->_getTitleFromLink($item->get_link());
             }
             $blogObj->title = EasyBlogStringHelper::unhtmlentities($blogObj->title);
             $blogObj->permalink = EasyBlogHelper::getPermalink($blogObj->title);
             $blogObj->publish_up = $mydate;
             $blogObj->isnew = !$feedObj->item_published ? true : false;
             $blog = EasyBlogHelper::getTable('blog');
             $blog->bind($blogObj);
             if ($feedObj->item_published) {
                 $blog->notify();
             }
             if ($blog->store()) {
                 $myCnt++;
                 //update the history with blog id
                 if (!empty($newHistoryId)) {
                     $tmpHistory = EasyBlogHelper::getTable('FeedHistory');
                     $tmpHistory->load($newHistoryId);
                     $tmpHistory->post_id = $blog->id;
                     $tmpHistory->store();
                 }
                 $itemMigrated++;
                 if ($feedObj->item_published) {
                     //insert activity here.
                     EasyBlogHelper::addJomSocialActivityBlog($blog, true, true);
                     // Determines if admin wants to auto post this item to the social sites.
                     if ($params->get('autopost')) {
                         $allowed = array(EBLOG_OAUTH_LINKEDIN, EBLOG_OAUTH_FACEBOOK, EBLOG_OAUTH_TWITTER);
                         // @rule: Process centralized options first
                         // See if there are any global postings enabled.
                         $blog->autopost($allowed, $allowed);
                     }
                 }
             }
             //end if
         }
     }
     return $itemMigrated;
 }