Example #1
0
 /**
  *
  * $filtering
  *      if index page:
  *      category_id
  *      filter
  *      sort
  *      query
  */
 public function toHTML($viewpage = 'index', $doReplace = false)
 {
     $data = $this->getData();
     if (count($data->pages) == $this->get('pages.total') && $this->get('pages.total') == '1' || $this->get('pages.total') == 0) {
         return false;
     }
     $queries = '';
     if (!empty($data) && $doReplace) {
         $curPageLink = 'index.php?option=com_easyblog&view=' . $viewpage . $queries;
         foreach ($data->pages as $page) {
             if (!empty($page->link)) {
                 $limitstart = !empty($page->base) ? '&limitstart=' . $page->base : '';
                 $page->link = EasyBlogRouter::_($curPageLink . $limitstart);
             }
         }
         // newer link
         if (!empty($data->next->link)) {
             $limitstart = !empty($data->next->base) ? '&limitstart=' . $data->next->base : '';
             $data->next->link = EasyBlogRouter::_($curPageLink . $limitstart);
         }
         // older link
         if (!empty($data->previous->link)) {
             $limitstart = !empty($data->previous->base) ? '&limitstart=' . $data->previous->base : '';
             $data->previous->link = EasyBlogRouter::_($curPageLink . $limitstart);
         }
     }
     $theme = new CodeThemes();
     $theme->set('data', $data);
     return $theme->fetch('blog.pagination.php');
 }
Example #2
0
 function display($tmpl = null)
 {
     $config = EasyBlogHelper::getConfig();
     $id = JRequest::getCmd('id', '0');
     $category = EasyBlogHelper::getTable('Category', 'Table');
     $category->load($id);
     // private category shouldn't allow to access.
     $privacy = $category->checkPrivacy();
     if (!$privacy->allowed) {
         return;
     }
     $catIds = array();
     $catIds[] = $category->id;
     EasyBlogHelper::accessNestedCategoriesId($category, $catIds);
     $model = $this->getModel('Blog');
     $posts = $model->getBlogsBy('category', $catIds);
     $weever = EasyBlogHelper::getHelper('Weever')->getMainFeed();
     $weever->set('description', JText::sprintf('COM_EASYBLOG_FEEDS_CATEGORY_DESC', $this->escape($category->title)));
     $weever->set('url', EasyBlogRouter::getRoutedUrl('index.php?option=com_easyblog&view=categories&id=' . $id . '&format=weever', false, true));
     $weever->set('thisPage', 1);
     $weever->set('lastPage', 1);
     if ($posts) {
         foreach ($posts as $post) {
             $blog = EasyBlogHelper::getTable('Blog');
             $blog->load($post->id);
             $weever->addChild($blog);
         }
     }
     $weever->toJSON(true, JRequest::getVar('callback'));
 }
 public function load($cid)
 {
     static $instances = array();
     if (!isset($instances[$cid])) {
         $this->_item = EasyBlogHelper::getTable('Blog', 'Table');
         if (!$this->_item->load($cid)) {
             return $this->onLoadArticleError($cid);
         }
         $blogger = EasyBlogHelper::getTable('Profile', 'Table');
         $blogger->load($this->_item->created_by);
         $this->_item->blogger = $blogger;
         $link = 'index.php?option=com_easyblog&view=entry&id=' . $this->getContentId();
         // forcefully get item id if request is ajax
         $format = JRequest::getString('format', 'html');
         if ($format === 'ajax') {
             $itemid = JRequest::getInt('pageItemId');
             if (!empty($itemid)) {
                 $link .= '&Itemid=' . $itemid;
             }
         }
         $link = EasyBlogRouter::_($link);
         $this->_item->permalink = $this->prepareLink($link);
         $instances[$cid] = $this->_item;
     }
     $this->_item = $instances[$cid];
     return $this;
 }
Example #4
0
    function links($rows, $team)
    {
        ?>
		<ul class="eblog_entry_links_list">
		<?php 
        for ($i = 1; $i < count($rows); $i++) {
            ?>
			<?php 
            $item = $rows[$i];
            ?>
			<li>
				<a href="<?php 
            echo EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $item->id);
            ?>
">
					<?php 
            echo JString::strlen($item->title) > 30 ? JString::substr(strip_tags($item->title), 0, 30) . '...' : strip_tags($item->title);
            ?>
				</a>
				<span><?php 
            echo JString::strlen($item->content) > 100 ? JString::substr(strip_tags($item->content), 0, 100) . '...' : strip_tags($item->content);
            ?>
</span>
			</li>
		<?php 
        }
        //end for
        ?>
		</ul>
<?php 
    }
Example #5
0
 function display($tmpl = null)
 {
     $config = EasyBlogHelper::getConfig();
     $id = JRequest::getInt('id');
     $team = EasyBlogHelper::getTable('TeamBlog');
     $team->load($id);
     if ($team->access != EBLOG_TEAMBLOG_ACCESS_EVERYONE) {
         return;
     }
     $model = $this->getModel('Blog');
     $posts = $model->getBlogsBy('teamblog', $team->id);
     $weever = EasyBlogHelper::getHelper('Weever')->getMainFeed();
     $weever->set('description', JText::sprintf('COM_EASYBLOG_FEEDS_TEAMBLOGS_DESC', $team->title));
     $weever->set('url', EasyBlogRouter::getRoutedUrl('index.php?option=com_easyblog&view=teamblog&id=' . $id . '&format=weever', false, true));
     $weever->set('thisPage', 1);
     $weever->set('lastPage', 1);
     if ($posts) {
         foreach ($posts as $post) {
             $blog = EasyBlogHelper::getTable('Blog');
             $blog->load($post->id);
             $weever->addChild($blog);
         }
     }
     $weever->toJSON(true, JRequest::getVar('callback'));
 }
Example #6
0
 public static function addCard(&$blog, $rawIntroText)
 {
     $cfg = EasyBlogHelper::getConfig();
     // @rule: Check if user really wants to append the opengraph tags on the headers.
     if (!$cfg->get('main_twitter_cards')) {
         return false;
     }
     // Get the absolute permalink for this blog item.
     $url = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true);
     // Get the image of the blog post.
     $image = self::getImage($blog, $rawIntroText);
     // @task: Get Joomla's document object.
     $doc = JFactory::getDocument();
     // Add card definition.
     $doc->addCustomTag('<meta property="twitter:card" content="summary" />');
     $doc->addCustomTag('<meta property="twitter:url" content="' . $url . '" />');
     $doc->addCustomTag('<meta property="twitter:title" content="' . $blog->title . '" />');
     $text = EasyBlogHelper::stripEmbedTags($rawIntroText);
     $text = strip_tags($text);
     $text = str_ireplace("\r\n", "", $text);
     // Remove any " in the content as this would mess up the headers.
     $text = str_ireplace('"', '', $text);
     $maxLength = 137;
     if (!empty($maxLength)) {
         $text = JString::strlen($text) > $maxLength ? JString::substr($text, 0, $maxLength) . '...' : $text;
     }
     $text = EasyBlogStringHelper::escape($text);
     $doc->addCustomTag('<meta property="twitter:description" content="' . $text . '" />');
     if ($image) {
         $doc->addCustomTag('<meta property="twitter:image" content="' . $image . '"/> ');
     }
     return true;
 }
Example #7
0
 public function store()
 {
     // @task: Load language file from the front end.
     JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
     $this->clear($this->draft_id);
     // @rule: Send notification to the author of the post.
     $draft = EasyBlogHelper::getTable('Draft');
     $draft->load($this->draft_id);
     $author = EasyBlogHelper::getTable('Profile');
     $author->load($draft->created_by);
     $data['blogTitle'] = $draft->title;
     $data['blogAuthor'] = $author->getName();
     $data['blogAuthorAvatar'] = $author->getAvatar();
     $data['blogEditLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=dashboard&layout=write&draft_id=' . $draft->id, false, true);
     $data['blogAuthorEmail'] = $author->user->email;
     $data['rejectMessage'] = $this->message;
     // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls.
     $sh404exists = EasyBlogRouter::isSh404Enabled();
     if (JFactory::getApplication()->isAdmin() && $sh404exists) {
         $data['blogEditLink'] = JURI::root() . 'index.php?option=com_easyblog&view=dashboard&layout=write&draft_id=' . $draft->id;
     }
     $emailTitle = JText::_('COM_EASYBLOG_EMAIL_TITLE_NEW_BLOG_REJECTED');
     $obj = new StdClass();
     $obj->unsubscribe = false;
     $obj->email = $author->user->email;
     $emails = array($obj);
     $notification = EasyBlogHelper::getHelper('Notification');
     $notification->send($emails, $emailTitle, 'email.blog.rejected', $data);
     return parent::store();
 }
Example #8
0
    public static function getHTML($row)
    {
        $config = EasyBlogHelper::getConfig();
        if (!$config->get('main_tweetmeme')) {
            return '';
        }
        $service = $config->get('main_tweetmeme_url');
        $style = $config->get('main_tweetmeme_style');
        $source = $config->get('main_tweetmeme_rtsource');
        $buttonSize = 'social-button-';
        switch ($style) {
            case 'normal':
                $buttonSize .= 'large';
                break;
            case 'compact':
            default:
                $buttonSize .= 'small';
                break;
        }
        $url = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $row->id, false, true);
        $title = addslashes($row->title);
        $placeholder = 'sb-' . rand();
        $html = '<div class="social-button ' . $buttonSize . ' tweetmeme"><span id="' . $placeholder . '"></span></div>';
        $html .= EasyBlogHelper::addScriptDeclarationBookmarklet('$("#' . $placeholder . '").bookmarklet("tweetMeme", {
			service: "' . $service . '",
			style: "' . $style . '",
			url: "' . $url . '",
			title: "' . $title . '",
			source: "' . $source . '"
		});');
        return $html;
    }
Example #9
0
 function display($tmpl = null)
 {
     $config = EasyBlogHelper::getConfig();
     $jConfig = EasyBlogHelper::getJConfig();
     if (!$config->get('main_rss')) {
         return;
     }
     $model = $this->getModel('Featured');
     $data = $model->getFeaturedBlog();
     $document = JFactory::getDocument();
     $document->link = EasyBlogRouter::_('index.php?option=com_easyblog&view=featured');
     $document->setTitle(JText::_('COM_EASYBLOG_FEEDS_FEATURED_TITLE'));
     $document->setDescription(JText::sprintf('COM_EASYBLOG_FEEDS_FEATURED_DESC', JURI::root()));
     if (!empty($data)) {
         for ($i = 0; $i < count($data); $i++) {
             $row =& $data[$i];
             $profile = EasyBlogHelper::getTable('Profile', 'Table');
             $profile->load($row->created_by);
             $created = EasyBlogDateHelper::dateWithOffSet($row->created);
             $formatDate = true;
             if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
                 $langCode = EasyBlogStringHelper::getLangCode();
                 if ($langCode != 'en-GB' || $langCode != 'en-US') {
                     $formatDate = false;
                 }
             }
             // $row->created       = ( $formatDate ) ? $created->toFormat( $config->get('layout_dateformat', '%A, %d %B %Y') ) : $created->toFormat();
             $row->created = $created->toMySQL();
             if ($config->get('main_rss_content') == 'introtext') {
                 $row->text = !empty($row->intro) ? $row->intro : $row->content;
                 //read more for feed
                 $row->text .= '<br /><a href=' . EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id) . '>Read more</a>';
             } else {
                 $row->text = $row->intro . $row->content;
             }
             $row->text = EasyBlogHelper::getHelper('Videos')->strip($row->text);
             $row->text = EasyBlogGoogleAdsense::stripAdsenseCode($row->text);
             $category = EasyBlogHelper::getTable('Category', 'Table');
             $category->load($row->category_id);
             // Assign to feed item
             $title = $this->escape($row->title);
             $title = html_entity_decode($title);
             // load individual item creator class
             $item = new JFeedItem();
             $item->title = $title;
             $item->link = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $row->id);
             $item->description = $row->text;
             $item->date = $row->created;
             $item->category = $category->title;
             $item->author = $profile->getName();
             if ($jConfig->get('feed_email') == 'author') {
                 $item->authorEmail = $profile->user->email;
             } else {
                 $item->authorEmail = $jConfig->get('mailfrom');
             }
             $document->addItem($item);
         }
     }
 }
Example #10
0
 public function getItemId()
 {
     $id = '';
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         $id = '&Itemid=' . EasyBlogRouter::getItemId('latest');
     }
     return $id;
 }
 public function mapPost($row, $strip_tags = '', $text_length = 0, $skip = array())
 {
     $config = EasyBlogHelper::getConfig();
     $blog = EasyBlogHelper::getTable('Blog');
     $blog->load($row->id);
     $profile = EasyBlogHelper::getTable('Profile', 'Table');
     $profile->load($row->created_by);
     $created = EasyBlogDateHelper::dateWithOffSet($row->created);
     $formatDate = true;
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         $langCode = EasyBlogStringHelper::getLangCode();
         if ($langCode != 'en-GB' || $langCode != 'en-US') {
             $formatDate = false;
         }
     }
     $blog->created = $created->toMySQL();
     $blog->text = $row->intro . $row->content;
     $config->set('max_video_width', 320);
     $config->set('max_video_width', 180);
     $blog->text = EasyBlogHelper::getHelper('Videos')->processVideos($blog->text);
     $blog->text = EasyBlogGoogleAdsense::stripAdsenseCode($blog->text);
     $category = EasyBlogHelper::getTable('Category', 'Table');
     $category->load($row->category_id);
     $item = new PostSimpleSchema();
     $item->textplain = $blog->text;
     // @TODO : Take care of a case when strip tags and length are used together
     if ($strip_tags) {
         $item->textplain = strip_tags($blog->text, $strip_tags);
     }
     if ($text_length > 0) {
         $pos = JString::strpos(strip_tags($item->textplain), ' ', $text_length);
         $item->textplain = JString::substr(strip_tags($blog->text), 0, $pos);
     }
     $image_data = json_decode($blog->image);
     $item->postid = $blog->id;
     $item->title = $blog->title;
     $item->text = $blog->text;
     $item->textplain = $this->sanitize($item->textplain);
     $item->image = $blog->getImage();
     $item->image->url = $image_data->url;
     $item->created_date = $blog->created;
     $item->created_date_elapsed = EasyBlogDateHelper::getLapsedTime($blog->created);
     $item->author->name = $profile->nickname;
     $item->author->photo = JURI::root() . $profile->avatar;
     $item->category->categoryid = $category->id;
     $item->category->title = $category->title;
     $item->url = JURI::root() . trim(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blog->id), '/');
     // Tags
     $modelPT = EasyBlogHelper::getModel('PostTag');
     $item->tags = $modelPT->getBlogTags($blog->id);
     foreach ($skip as $v) {
         unset($item->{$v});
     }
     return $item;
 }
Example #12
0
 /**
  * Appends the necessary rss fragments on existing url
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function getFeedURL($url, $atom = false, $type = 'site')
 {
     if ($this->config->get('main_feedburner') && $type == 'site' && $this->config->get('main_feedburner_url') != '') {
         return $this->config->get('main_feedburner_url');
     }
     $join = EasyBlogRouter::isSefEnabled() ? '?' : '&';
     // Append the necessary queries
     $url = EBR::_($url) . $join . 'format=feed';
     $url .= $atom ? '&type=atom' : '&type=rss';
     return $url;
 }
Example #13
0
 function display($tmpl = null)
 {
     $my = JFactory::getUser();
     if ($my->id < 1) {
         EasyBlogHelper::showLogin();
         return;
     }
     JPluginHelper::importPlugin('easyblog');
     $dispatcher = JDispatcher::getInstance();
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $acl = EasyBlogACLHelper::getRuleSet();
     $config = EasyBlogHelper::getConfig();
     $sort = JRequest::getCmd('sort', $config->get('layout_postorder'));
     $blogger = EasyBlogHelper::getTable('Profile', 'Table');
     $blogger->load($my->id);
     // set meta tags for blogger
     EasyBlogHelper::setMeta($my->id, META_ID_BLOGGERS);
     if (!EasyBlogRouter::isCurrentActiveMenu('myblog', $my->id)) {
         $this->setPathway(JText::_('COM_EASYBLOG_BLOGGERS_BREADCRUMB'), EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger'));
         $this->setPathway($blogger->getName());
     }
     $model = $this->getModel('Blog');
     $data = $model->getBlogsBy('blogger', $blogger->id, $sort);
     $pagination = $model->getPagination();
     $pageNumber = $pagination->get('pages.current');
     $pageText = $pageNumber == 1 ? '' : ' - ' . JText::sprintf('COM_EASYBLOG_PAGE_NUMBER', $pageNumber);
     $document->setTitle($blogger->getName() . $pageText . EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_MY_BLOG_PAGE_TITLE')));
     $data = EasyBlogHelper::formatBlog($data, false, true, true, true);
     if ($config->get('layout_showcomment', false)) {
         for ($i = 0; $i < count($data); $i++) {
             $row =& $data[$i];
             $maxComment = $config->get('layout_showcommentcount', 3);
             $comments = EasyBlogHelper::getHelper('Comment')->getBlogComment($row->id, $maxComment, 'desc');
             $comments = EasyBlogHelper::formatBlogCommentsLite($comments);
             $row->comments = $comments;
         }
     }
     $rssURL = EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger&task=rss');
     //twitter follow me link
     $twitterFollowMelink = EasyBlogSocialShareHelper::getLink('twitter', $blogger->id);
     $theme = new CodeThemes();
     $theme->set('rssURL', $rssURL);
     $theme->set('blogger', $blogger);
     $theme->set('sort', $sort);
     $theme->set('blogs', $data);
     $theme->set('currentURL', 'index.php?option=com_easyblog&view=latest');
     $theme->set('pagination', $pagination->getPagesLinks());
     $theme->set('twitterFollowMelink', $twitterFollowMelink);
     $theme->set('my', $my);
     $theme->set('acl', $acl);
     echo $theme->fetch('blog.blogger.php');
 }
Example #14
0
 public static function _getMenuItemId($post, &$params)
 {
     $itemId = '';
     $routeTypeCategory = false;
     $routeTypeBlogger = false;
     $routeTypeTag = false;
     $routingType = $params->get('routingtype', 'default');
     if ($routingType != 'default') {
         switch ($routingType) {
             case 'menuitem':
                 $itemId = $params->get('menuitemid') ? '&Itemid=' . $params->get('menuitemid') : '';
                 break;
             case 'category':
                 $routeTypeCategory = true;
                 break;
             case 'blogger':
                 $routeTypeBlogger = true;
                 break;
             case 'tag':
                 $routeTypeTag = true;
                 break;
             default:
                 break;
         }
     }
     if ($routeTypeCategory) {
         $xid = EasyBlogRouter::getItemIdByCategories($post->category_id);
     } else {
         if ($routeTypeBlogger) {
             $xid = EasyBlogRouter::getItemIdByBlogger($post->created_by);
         } else {
             if ($routeTypeTag) {
                 $tags = self::_getPostTagIds($post->id);
                 if ($tags !== false) {
                     foreach ($tags as $tag) {
                         $xid = EasyBlogRouter::getItemIdByTag($tag);
                         if ($xid !== false) {
                             break;
                         }
                     }
                 }
             }
         }
     }
     if (!empty($xid)) {
         // lets do it, do it, do it, lets override the item id!
         $itemId = '&Itemid=' . $xid;
     }
     return $itemId;
 }
Example #15
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 #16
0
 function request()
 {
     $mainframe = JFactory::getApplication();
     if (!EasyBlogHelper::isLoggedIn()) {
         $mainframe->enqueueMessage(JText::_('COM_EASYBLOG_YOU_MUST_LOGIN_FIRST'), 'error');
         $this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog', false));
         return;
     }
     $redirect = JRequest::getVar('redirect', '');
     $type = JRequest::getCmd('type');
     if (!empty($redirect)) {
         $redirect = '&redirect=' . $redirect;
     }
     $userId = JRequest::getVar('id');
     // Flickr integration does not require user id.
     if (empty($userId)) {
         $mainframe->enqueueMessage(JText::_('Error, User not found.'), 'error');
         $redirect = JRoute::_('index.php?option=com_easyblog&view=users', false);
         $this->setRedirect($redirect);
         return;
     }
     $call = JRequest::getWord('call');
     $callUri = !empty($call) ? '&call=' . $call . '&id=' . $userId : '&id=' . $userId;
     $config = EasyBlogHelper::getConfig();
     $key = $config->get('integrations_' . $type . '_api_key');
     $secret = $config->get('integrations_' . $type . '_secret_key');
     $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);
     $request = $consumer->getRequestToken();
     if (empty($request->token) || empty($request->secret)) {
         $mainframe->enqueueMessage(JText::_('COM_EASYBLOG_OAUTH_KEY_INVALID'), 'error');
         $redirect = JRoute::_('index.php?option=com_easyblog&view=users', false);
         $this->setRedirect($redirect);
         return;
     }
     $oauth = EasyBlogHelper::getTable('Oauth', 'Table');
     $oauth->user_id = $userId;
     $oauth->type = $type;
     $oauth->created = EasyBlogHelper::getDate()->toMySQL();
     // Bind the request tokens
     $param = EasyBlogHelper::getRegistry('');
     $param->set('token', $request->token);
     $param->set('secret', $request->secret);
     $oauth->request_token = $param->toString();
     $oauth->store();
     $this->setRedirect($consumer->getAuthorizationURL($request->token, false, 'popup'));
 }
Example #17
0
 function display($tmpl = null)
 {
     $config = EasyBlogHelper::getConfig();
     $model = $this->getModel('Blog');
     $posts = $model->getBlogsBy('', '', 'latest', 0, EBLOG_FILTER_PUBLISHED, null, true);
     $weever = EasyBlogHelper::getHelper('Weever')->getMainFeed();
     $weever->set('description', JText::sprintf('COM_EASYBLOG_FEEDS_LATEST_DESC', JURI::root()));
     $weever->set('url', EasyBlogRouter::getRoutedUrl('index.php?option=com_easyblog&view=latest', false, true));
     $weever->set('thisPage', 1);
     $weever->set('lastPage', 1);
     foreach ($posts as $post) {
         $blog = EasyBlogHelper::getTable('Blog');
         $blog->load($post->id);
         $weever->addChild($blog);
     }
     $weever->toJSON(true, JRequest::getVar('callback'));
 }
Example #18
0
 function getFeedURL($url, $atom = false, $type = 'site')
 {
     $config = EasyBlogHelper::getConfig();
     $enabled = $config->get('main_feedburner');
     if ($enabled && $type == 'site' && $config->get('main_feedburner_url') != '') {
         $url = $config->get('main_feedburner_url');
         if (!empty($url)) {
             return EasyBlogHelper::getHelper('String')->escape($url);
         }
     }
     require_once EBLOG_HELPERS . DIRECTORY_SEPARATOR . 'router.php';
     $sef = EasyBlogRouter::isSefEnabled();
     $join = $sef ? '?' : '&';
     $url = EasyBlogRouter::_($url) . $join . 'format=feed';
     $url .= $atom ? '&type=atom' : '&type=rss';
     return $url;
 }
Example #19
0
 /**
  * Displays the default categories layout
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function display($tmpl = null)
 {
     // Set meta tags for bloggers
     EB::setMeta(META_ID_GATEGORIES, META_TYPE_VIEW);
     // If the active menu is this view, we should not make the breadcrumb linkable.
     if (EasyBlogRouter::isCurrentActiveMenu('categories')) {
         $this->setPathway(JText::_('COM_EASYBLOG_CATEGORIES_BREADCRUMB'), '');
     }
     // Sorting options
     $defaultSorting = $this->config->get('layout_sorting_category', 'latest');
     $sort = $this->input->get('sort', $defaultSorting, 'cmd');
     // Load up our own models
     $model = EB::model('Category');
     // Test if there's any explicit inclusion of categories
     $menu = $this->app->getMenu()->getActive();
     $inclusion = '';
     if (is_object($menu) && stristr($menu->link, 'view=categories') !== false) {
         $inclusion = EB::getCategoryInclusion($menu->params->get('inclusion'));
     }
     // Get the number of categories to show per page
     $limit = $this->config->get('layout_pagination_categories_per_page');
     // Get the categories
     $categories = $model->getCategories($sort, $this->config->get('main_categories_hideempty'), $limit, $inclusion);
     // Get the pagination
     $pagination = $model->getPagination();
     $pagination = $pagination->getPagesLinks();
     // Format the categories
     $categories = EB::formatter('categories', $categories);
     // Update the title of the page if navigating on different pages to avoid Google marking these title's as duplicates.
     $title = EB::getPageTitle(JText::_('COM_EASYBLOG_CATEGORIES_PAGE_TITLE'));
     $this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     // Add canonical URLs.
     $this->canonical('index.php?option=com_easyblog&view=categories');
     // Get the default pagination limit for authors
     $limit = $this->app->getCfg('list_limit');
     $limit = $limit == 0 ? 5 : $limit;
     $this->set('limit', $limit);
     $this->set('categories', $categories);
     $this->set('sort', $sort);
     $this->set('pagination', $pagination);
     $namespace = 'blogs/categories/default';
     if ($this->getLayout() == 'simple') {
         $namespace = 'blogs/categories/default.simple';
     }
     parent::display($namespace);
 }
 function getObjectInfo($id, $language = null)
 {
     $info = new JCommentsObjectInfo();
     $routerHelper = JPATH_ROOT . '/components/com_easyblog/helpers/router.php';
     if (is_file($routerHelper)) {
         require_once $routerHelper;
         $db = JCommentsFactory::getDBO();
         $db->setQuery('SELECT id, title, created_by FROM #__easyblog_post WHERE id = ' . $id);
         $row = $db->loadObject();
         if (!empty($row)) {
             $info->title = $row->title;
             $info->userid = $row->created_by;
             $info->link = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $id);
         }
     }
     return $info;
 }
Example #21
0
 /**
  * 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);
 }
Example #22
0
 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'));
         }
     }
 }
Example #23
0
 public function sendApprovalEmail($approvalType)
 {
     $user = EasyBlogHelper::getTable('Profile');
     $user->load($this->user_id);
     $team = EasyBlogHelper::getTable('TeamBlog');
     $team->load($this->team_id);
     $template = $approvalType ? 'email.teamblog.approved' : 'email.teamblog.rejected';
     $obj = new stdClass();
     $obj->unsubscribe = false;
     $obj->email = $user->user->email;
     $emails = array($obj->email => $obj);
     $data = array('teamName' => $team->title, 'teamDescription' => $team->getDescription(), 'teamAvatar' => $team->getAvatar(), 'teamLink' => EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=teamblog&layout=listings&id=' . $this->team_id, false, true));
     // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls.
     $sh404exists = EasyBlogRouter::isSh404Enabled();
     if (JFactory::getApplication()->isAdmin() && $sh404exists) {
         $data['teamLink'] = JURI::root() . 'index.php?option=com_easyblog&view=teamblog&layout=listings&id=' . $team->id;
     }
     $notification = EasyBlogHelper::getHelper('Notification');
     $notification->send($emails, JText::_('COM_EASYBLOG_TEAMBLOG_JOIN_REQUEST'), $template, $data);
 }
Example #24
0
 function display($tmpl = null)
 {
     JPluginHelper::importPlugin('easyblog');
     $dispatcher = JDispatcher::getInstance();
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $config = EasyBlogHelper::getConfig();
     $acl = EasyBlogACLHelper::getRuleSet();
     if (!EasyBlogRouter::isCurrentActiveMenu('featured')) {
         $this->setPathway(JText::_('COM_EASYBLOG_FEATURED_BREADCRUMB'));
     }
     // set meta tags for featured view
     EasyBlogHelper::setMeta(META_ID_FEATURED, META_TYPE_VIEW);
     EasyBlogHelper::getHelper('Feeds')->addHeaders('index.php?option=com_easyblog&view=featured');
     $model = $this->getModel('Featured');
     $data = $model->getFeaturedBlog();
     $pagination = $model->getPagination();
     $params = $mainframe->getParams('com_easyblog');
     $data = EasyBlogHelper::formatBlog($data);
     $blogModel = $this->getModel('Blog');
     $pageNumber = $pagination->get('pages.current');
     $pageText = $pageNumber == 1 ? '' : ' - ' . JText::sprintf('COM_EASYBLOG_PAGE_NUMBER', $pageNumber);
     $document->setTitle(EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_FEATURED_PAGE_TITLE') . $pageText));
     if ($config->get('layout_showcomment', false)) {
         for ($i = 0; $i < count($data); $i++) {
             $row =& $data[$i];
             $maxComment = $config->get('layout_showcommentcount', 3);
             $comments = EasyBlogHelper::getHelper('Comment')->getBlogComment($row->id, $maxComment, 'desc');
             $comments = EasyBlogHelper::formatBlogCommentsLite($comments);
             $row->comments = $comments;
         }
     }
     $theme = new CodeThemes();
     $theme->set('data', $data);
     $theme->set('pagination', $pagination->getPagesLinks());
     $theme->set('currentURL', 'index.php?option=com_easyblog&view=featured');
     $theme->set('siteadmin', EasyBlogHelper::isSiteAdmin());
     $theme->set('config', $config);
     $theme->set('acl', $acl);
     echo $theme->fetch('blog.featured.php');
 }
Example #25
0
 function get_link($num)
 {
     if ($this->mode == 'com_content') {
         return $this->parent->content[$num]['id'] != 0 ? JRoute::_(ContentHelperRoute::getArticleRoute($this->parent->content[$num]['id'], $this->parent->content[$num]['cid'])) : JRoute::_('index.php?option=com_users&view=login');
     } else {
         if ($this->mode == 'com_k2') {
             //
             require_once JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'helpers' . DS . 'route.php';
             //
             return urldecode(JRoute::_(K2HelperRoute::getItemRoute($this->parent->content[$num]['id'] . ':' . urlencode($this->parent->content[$num]['alias']), $this->parent->content[$num]['cid'] . ':' . urlencode($this->parent->content[$num]['cat_alias']))));
         } else {
             if ($this->mode == 'com_easyblog') {
                 //
                 require_once JPATH_SITE . DS . 'components' . DS . 'com_easyblog' . DS . 'helpers' . DS . 'router.php';
                 //
                 return urldecode(JRoute::_(EasyBlogRouter::getEntryRoute($this->parent->content[$num]['id'])));
             } else {
                 return false;
             }
         }
     }
 }
Example #26
0
 function display($tmpl = null)
 {
     $config = EasyBlogHelper::getConfig();
     $id = JRequest::getInt('id');
     $blogger = EasyBlogHelper::getTable('Profile', 'Table');
     $blogger->load($id);
     $model = $this->getModel('Blog');
     $posts = $model->getBlogsBy('blogger', $blogger->id);
     $weever = EasyBlogHelper::getHelper('Weever')->getMainFeed();
     $weever->set('description', strip_tags($blogger->description));
     $weever->set('url', EasyBlogRouter::getRoutedUrl('index.php?option=com_easyblog&view=blogger&id=' . $id . '&format=weever', false, true));
     $weever->set('thisPage', 1);
     $weever->set('lastPage', 1);
     if ($posts) {
         foreach ($posts as $post) {
             $blog = EasyBlogHelper::getTable('Blog');
             $blog->load($post->id);
             $weever->addChild($blog);
         }
     }
     $weever->toJSON(true, JRequest::getVar('callback'));
 }
Example #27
0
 function display($tmpl = null)
 {
     $config = EasyBlogHelper::getConfig();
     $id = JRequest::getCmd('id', '0');
     $tag = EasyBlogHelper::getTable('Tag');
     $tag->load($id);
     $model = $this->getModel('Blog');
     $posts = $model->getTaggedBlogs($id);
     $weever = EasyBlogHelper::getHelper('Weever')->getMainFeed();
     $weever->set('description', JText::sprintf('COM_EASYBLOG_FEEDS_TAGS_DESC', htmlentities($tag->title)));
     $weever->set('url', EasyBlogRouter::getRoutedUrl('index.php?option=com_easyblog&view=categories&id=' . $id . '&format=weever', false, true));
     $weever->set('thisPage', 1);
     $weever->set('lastPage', 1);
     if ($posts) {
         foreach ($posts as $post) {
             $blog = EasyBlogHelper::getTable('Blog');
             $blog->load($post->id);
             $weever->addChild($blog);
         }
     }
     $weever->toJSON(true, JRequest::getVar('callback'));
 }
Example #28
0
 public function notify(EasyBlogTableBlog $blog)
 {
     $config = EasyBlogHelper::getConfig();
     // Send notification to site admins when a new blog post is reported
     $data = array();
     $data['blogTitle'] = $blog->title;
     $data['blogLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true);
     // @rule: Send email notifications out to subscribers.
     $author = EasyBlogHelper::getTable('Profile');
     $author->load($this->created_by);
     $data['reporterAvatar'] = $author->getAvatar();
     $data['reporterName'] = $author->getName();
     $data['reporterLink'] = $author->getProfileLink();
     $data['reason'] = $this->reason;
     $date = EasyBlogDateHelper::dateWithOffSet($this->created);
     $data['reportDate'] = EasyBlogDateHelper::toFormat($date, '%A, %B %e, %Y');
     // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls.
     $sh404exists = EasyBlogRouter::isSh404Enabled();
     if (JFactory::getApplication()->isAdmin() && $sh404exists) {
         $data['blogLink'] = JURI::root() . 'index.php?option=com_easyblog&view=entry&id=' . $blog->id;
     }
     $emailBlogTitle = JString::substr($blog->title, 0, $config->get('main_mailtitle_length'));
     $emailTitle = JText::sprintf('COM_EASYBLOG_EMAIL_TITLE_NEW_REPORT', $emailBlogTitle) . ' ...';
     $notification = EasyBlogHelper::getHelper('Notification');
     $emails = array();
     // @rule: Fetch custom emails defined at the back end.
     if ($config->get('notification_blogadmin')) {
         if ($config->get('custom_email_as_admin')) {
             $notification->getCustomEmails($emails);
         } else {
             $notification->getAdminEmails($emails);
         }
     }
     if (!empty($emails)) {
         $notification->send($emails, $emailTitle, 'email.blog.report', $data);
     }
 }
Example #29
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;
 }
echo JText::_('COM_EASYBLOG_AUTOPOSTING_FACEBOOK_ACCESS');
?>
</span>
					</td>
					<td valign="top">
						<?php 
if ($this->isAssociated) {
    ?>
							<div class="has-tip">
								<div class="tip"><i></i><?php 
    echo JText::_('COM_EASYBLOG_AUTOPOSTING_FACEBOOK_ACCESS_DESC');
    ?>
</div>
								<div style="margin-top:5px;">
									<a href="<?php 
    echo EasyBlogRouter::_('index.php?option=com_easyblog&c=autoposting&task=revoke&type=' . EBLOG_OAUTH_FACEBOOK . '&return=form');
    ?>
"><?php 
    echo JText::_('COM_EASYBLOG_OAUTH_REVOKE_ACCESS');
    ?>
</a>
								</div>

								<p style="margin:15px 0 8px 0;">
									<?php 
    echo JText::_('COM_EASYBLOG_FACEBOOK_EXPIRE_TOKEN');
    ?>
 <strong><?php 
    echo $this->expire;
    ?>
</strong>.