Esempio n. 1
0
 /**
  * Displays the calendar layout
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function display($tpl = null)
 {
     // Set the pathway
     $this->setPathway('COM_EASYBLOG_CALENDAR_BREADCRUMB');
     // Get the year and month if it's defined in the menu
     $year = $this->theme->params->get('calendar_year', 0);
     $month = $this->theme->params->get('calendar_month', 0);
     // Perhaps the year and month are being passed as query strings
     $year = $this->input->get('year', $year, 'default');
     $month = $this->input->get('month', $month, 'default');
     $day = $this->input->get('day', '01', 'default');
     // Get the Itemid
     $itemId = $this->input->get('Itemid', 0, 'int');
     // Try to generate timestamp if there's year and month provided
     $timestamp = '';
     if ($year && $month) {
         $timestamp = strtotime($year . '-' . $month . '-' . $day);
     }
     $this->set('timestamp', $timestamp);
     // get the calendar date.
     $date = EB::calendar()->getDateObject($timestamp);
     // meta, too late to add new meta id so we 'trick' the system to use the custom description.
     EB::setMeta('0', META_TYPE_VIEW, JText::_('COM_EASYBLOG_CALENDAR_PAGE_TITLE') . ' ' . $date->year . ', ' . $date->month);
     // Set the page title
     $title = EB::getPageTitle(JText::_('COM_EASYBLOG_CALENDAR_PAGE_TITLE') . ' ' . $date->year . ', ' . $date->month);
     parent::setPageTitle($title, false, $this->config->get('main_pagetitle_autoappend'));
     return parent::display('blogs/calendar/default');
 }
Esempio n. 2
0
 public function display($tmpl = null)
 {
     // Ensure that the user is logged in.
     EB::requireLogin();
     // null = new post
     // 63   = post 63 from post table
     // 63.2 = post 63, revision 2 from history table
     $uid = $this->input->getVar('uid', null);
     // If no id given, create a new post.
     $post = EB::post($uid);
     // Verify access (see function manager())
     if (!$post->canCreate() && !$post->canEdit()) {
         // Do not allow user to access this page if he doesn't have access
         JError::raiseError(500, JText::_('COM_EASYBLOG_NOT_ALLOWED_ACCESS_IN_THIS_SECTION'));
         return;
     }
     // If there's no id provided, we will need to create the initial revision for the post.
     if (!$uid) {
         $post->create();
         $uid = $post->uid;
     }
     // Determines if we should show the sidebars by default
     $templateId = $this->input->get('block_template', 0, 'int');
     if (!$post->title) {
         $this->doc->setTitle(JText::_('COM_EASYBLOG_COMPOSER_POST_UNTITLED'));
     }
     $composer = EB::composer();
     // Render default post templates
     $postTemplatesModel = EB::model('Templates');
     $postTemplates = $postTemplatesModel->getPostTemplates($this->my->id);
     $this->set('postTemplates', $postTemplates);
     $this->set('composer', $composer);
     $this->set('post', $post);
     return parent::display('composer/default');
 }
Esempio n. 3
0
 /**
  * Default display method for featured listings
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return	
  */
 public function display($tmpl = null)
 {
     // Set the meta tags for this page
     EB::setMeta(META_ID_FEATURED, META_TYPE_VIEW);
     // Add the RSS headers on the page
     EB::feeds()->addHeaders('index.php?option=com_easyblog&view=featured');
     // Add breadcrumbs on the site menu.
     $this->setPathway('COM_EASYBLOG_FEATURED_BREADCRUMB');
     // Get the model
     $model = EB::model('Featured');
     // Get a list of featured posts
     $posts = $model->getPosts();
     // Get the pagination
     $pagination = $model->getPagination();
     // Format the posts
     $posts = EB::formatter('list', $posts);
     // Set the page title
     $title = EB::getPageTitle(JText::_('COM_EASYBLOG_FEATURED_PAGE_TITLE'));
     $this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     // Get the current url
     $return = EBR::_('index.php?option=com_easyblog', false);
     $this->set('return', $return);
     $this->set('posts', $posts);
     $this->set('pagination', $pagination);
     parent::display('blogs/featured/default');
 }
Esempio n. 4
0
 /**
  * Displays the calendar layout 
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return	
  */
 public function display($tpl = null)
 {
     // Set the pathway
     $this->setPathway('COM_EASYBLOG_CALENDAR_BREADCRUMB');
     // Get the year and month if it's defined in the menu
     $year = $this->theme->params->get('calendar_year', 0);
     $month = $this->theme->params->get('calendar_month', 0);
     // dump($year, $month);
     // Perhaps the year and month are being passed as query strings
     $year = $this->input->get('year', $year, 'default');
     $month = $this->input->get('month', $month, 'default');
     $day = $this->input->get('day', '01', 'default');
     // Get the Itemid
     $itemId = $this->input->get('Itemid', 0, 'int');
     // Try to generate timestamp if there's year and month provided
     $timestamp = '';
     if ($year && $month) {
         $timestamp = strtotime($year . '-' . $month . '-' . $day);
     }
     $this->set('timestamp', $timestamp);
     // Set the page title
     $title = EB::getPageTitle(JText::_('COM_EASYBLOG_CALENDAR_PAGE_TITLE'));
     parent::setPageTitle($title, false, $this->config->get('main_pagetitle_autoappend'));
     return parent::display('blogs/calendar/default');
 }
Esempio n. 5
0
 public function display($tmpl = null)
 {
     // Get the model
     $model = EB::model('Search');
     $posts = $model->getData();
     $posts = EB::formatter('list', $posts);
     $this->set('posts', $posts);
     return parent::display();
 }
Esempio n. 6
0
 /**
  * Default method to render listings in json format.
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function display($tmpl = null)
 {
     // Get the sorting options
     $sort = $this->input->get('sort', $this->config->get('layout_postorder'));
     $model = EB::model('Blog');
     $posts = $model->getBlogsBy('', '', $sort, 0, EBLOG_FILTER_PUBLISHED, null, true);
     // Format the posts
     $posts = EB::formatter('list', $posts);
     $this->set('posts', $posts);
     return parent::display();
 }
Esempio n. 7
0
 /**
  * Displays the default archives view
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function display($tpl = null)
 {
     // Get the archives model
     $model = EB::model('Archive');
     // Get a list of posts
     $posts = $model->getPosts();
     // Format the posts
     $posts = EB::formatter('list', $posts);
     // Get the pagination
     $pagination = $model->getPagination();
     $this->set('posts', $posts);
     $this->set('pagination', $pagination);
     parent::display('blogs/archives/list');
 }
Esempio n. 8
0
 public function display($tmpl = null)
 {
     // If user is already logged in, just redirect them
     if (!$this->my->guest) {
         $this->info->set(JText::_('COM_EASYBLOG_YOU_ARE_ALREADY_LOGIN'), 'error');
         return $this->app->redirect(EBR::_('index.php?option=com_easyblog'));
     }
     // Determines if there's any return url
     $return = $this->input->get('return', '');
     if (empty($return)) {
         $return = base64_encode(EBR::_('index.php?option=com_easyblog', false));
     }
     $this->set('return', $return);
     parent::display('login/default');
 }
Esempio n. 9
0
 /**
  * Default display method for my blog listings
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function display($tmpl = null)
 {
     // Require user to be logged in to access this page
     EB::requireLogin();
     // Get the default sorting behavior
     $sort = $this->input->get('sort', $this->config->get('layout_postorder'), 'cmd');
     // Load up the author profile
     $author = EB::user($this->my->id);
     // Set meta tags for blogger
     EB::setMeta($this->my->id, META_ID_BLOGGERS);
     // Set the breadcrumbs
     $this->setPathway(JText::_('COM_EASYBLOG_BLOGGERS_BREADCRUMB'), EB::_('index.php?option=com_easyblog&view=blogger'));
     $this->setPathway($author->getName());
     $menu = JFactory::getApplication()->getMenu();
     $categoryInclusion = array();
     if ($menu) {
         $active = $menu->getActive();
         $categoryInclusion = $active->params->get('inclusion');
     }
     $model = EB::model('Blog');
     $posts = $model->getBlogsBy('blogger', $author->id, $sort, 0, EBLOG_FILTER_PUBLISHED, false, false, array(), false, false, true, array(), $categoryInclusion);
     // Get the pagination
     $pagination = $model->getPagination();
     // Set the page title
     $title = $author->getName() . ' - ' . EB::getPageTitle(JText::_('COM_EASYBLOG_MY_BLOG_PAGE_TITLE'));
     $this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     // Format the posts
     $posts = EB::formatter('list', $posts);
     // Add the RSS headers on the page
     EB::feeds()->addHeaders('index.php?option=com_easyblog&view=myblog');
     // Determines if the viewer already subscribed to the author
     $subscribed = false;
     $bloggerModel = EB::model('Blogger');
     if ($bloggerModel->isBloggerSubscribedUser($author->id, $this->my->id, $this->my->email)) {
         $subscribed = true;
     }
     // Get the current url
     $return = EBR::_('index.php?option=com_easyblog', false);
     $this->set('return', $return);
     $this->set('subscribed', $subscribed);
     $this->set('author', $author);
     $this->set('posts', $posts);
     $this->set('sort', $sort);
     $this->set('pagination', $pagination);
     parent::display('blogs/myblog/default');
 }
Esempio n. 10
0
 /**
  * Displays the default archives view
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function display($tpl = null)
 {
     // Get the archives model
     $model = EB::model('Archive');
     // Get a list of posts
     $posts = $model->getPosts();
     // Format the posts
     $posts = EB::formatter('list', $posts);
     // Get the pagination
     $pagination = $model->getPagination();
     // meta
     EB::setMeta(META_ID_ARCHIVE, META_TYPE_VIEW);
     // 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_ARCHIVE_PAGE_TITLE'));
     parent::setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     $this->set('posts', $posts);
     $this->set('pagination', $pagination);
     parent::display('blogs/archives/list');
 }
Esempio n. 11
0
 /**
  * Displays a list of subscriptions the user belongs to.
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function display($tpl = null)
 {
     // Check for acl
     $this->checkAcl('allow_subscription');
     // Do not allow guests to access this page
     if ($this->my->guest) {
         return EB::requireLogin();
     }
     // Set the title of the page
     $this->doc->setTitle(JText::_('COM_EASYBLOG_SUBSCRIPTIONS_PAGE_TITLE'));
     // Add pathway
     if (!EBR::isCurrentActiveMenu('subscription')) {
         $this->setPathway(JText::_('COM_EASYBLOG_SUBSCRIPTIONS_BREADCRUMB'));
     }
     // Ensure that the user has access to manage subscriptions
     if (!$this->acl->get('allow_subscription')) {
         return JError::raiseError(500, JText::_('COM_EASYBLOG_YOU_DO_NOT_HAVE_PERMISSION_TO_VIEW'));
     }
     // Get a list of subscriptions the user has
     $model = EB::model('Subscriptions');
     $result = $model->getSubscriptionsByUser($this->my->id);
     $subscriptions = array();
     $groups = array();
     if ($result) {
         foreach ($result as $row) {
             $type = $row->utype;
             $groups[] = $type;
             if (!isset($subscriptions[$type])) {
                 $subscriptions[$row->utype] = array();
             }
             // Get the formatted type title
             $row->object = $row->getObject();
             $subscriptions[$row->utype][] = $row;
         }
     }
     // Ensure that the groups are unique
     $groups = array_unique($groups);
     $this->set('groups', $groups);
     $this->set('subscriptions', $subscriptions);
     parent::display('subscription/default');
 }
Esempio n. 12
0
 /**
  * Displays blog posts from a specific category
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return	
  */
 public function listings()
 {
     // Get the main category
     $id = $this->input->get('id', 0, 'int');
     $category = EB::table('Category');
     $category->load($id);
     // Check for the category privacy
     if (!$category->checkPrivacy()) {
         // @TODO: Display proper error message
         return;
     }
     $catIds = array();
     $catIds[] = $category->id;
     EB::accessNestedCategoriesId($category, $catIds);
     $model = EB::model('Category');
     $posts = $model->getPosts($catIds);
     $posts = EB::formatter('list', $posts);
     $this->set('category', $category);
     $this->set('posts', $posts);
     return parent::display();
 }
Esempio n. 13
0
 public function display($tmpl = null)
 {
     // Get the blog post
     $id = $this->input->get('id', 0, 'int');
     // Load the blog post now
     $blog = EB::table('Blog');
     $blog->load($id);
     // If blog id is not provided correctly, throw a 404 error page
     if (!$id || !$blog->id) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
     }
     // If the settings requires the user to be logged in, do not allow guests here.
     if ($this->my->id <= 0 && $this->config->get('main_login_read')) {
         $url = EB::_('index.php?option=com_easyblog&view=entry&id=' . $id . '&layout=login', false);
         return $this->app->redirect($url);
     }
     // Check if blog is password protected.
     if ($this->config->get('main_password_protect') && !empty($blog->blogpassword) && !$blog->verifyPassword()) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
     }
     // If the blog post is already deleted, we shouldn't let it to be accessible at all.
     if ($blog->isTrashed()) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
     }
     // Check if the blog post is trashed
     if (!$blog->isPublished() && $my->id != $blog->created_by && !EB::isSiteAdmin()) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
     }
     // If the viewer is the owner of the blog post, display a proper message
     if ($this->my->id == $blog->created_by && !$blog->isPublished()) {
         $notice = JText::_('COM_EASYBLOG_ENTRY_BLOG_UNPUBLISHED_VISIBLE_TO_OWNER');
     }
     if (EB::isSiteAdmin() && !$blog->isPublished()) {
         $notice = JText::_('COM_EASYBLOG_ENTRY_BLOG_UNPUBLISHED_VISIBLE_TO_ADMIN');
     }
     $blog = EB::formatter('post', $blog);
     $this->set('post', $blog);
     return parent::display();
 }
Esempio n. 14
0
 public function __construct()
 {
     // Ensure that the user is logged in
     EB::requireLogin();
     parent::__construct();
 }
Esempio n. 15
0
 /**
  * Display specific tag from the site.
  **/
 function tag()
 {
     $document = JFactory::getDocument();
     $config = EasyBlogHelper::getConfig();
     $my = JFactory::getUser();
     $acl = EasyBlogACLHelper::getRuleSet();
     $id = JRequest::getVar('id', '', 'REQUEST');
     JTable::addIncludePath(EBLOG_TABLES);
     // Add noindex for tags view by default.
     $document->setMetadata('robots', 'noindex,follow');
     $tag = EasyBlogHelper::getTable('Tag', 'Table');
     $tag->load($id);
     $title = EasyBlogHelper::getPageTitle($tag->title);
     // @task: Set the page title
     parent::setPageTitle($title, false, $config->get('main_pagetitle_autoappend'));
     // set meta tags for tags view
     EasyBlogHelper::setMeta(META_ID_TAGS, META_TYPE_VIEW, JText::_($tag->title) . ' - ' . EasyBlogHelper::getPageTitle($config->get('main_title')));
     if (!EasyBlogRouter::isCurrentActiveMenu('tags')) {
         $this->setPathway(JText::_('COM_EASYBLOG_TAGS_BREADCRUMB'), EasyBlogRouter::_('index.php?option=com_easyblog&view=tags'));
     }
     $this->setPathway(JText::_($tag->title));
     $blogModel = $this->getModel('Blog');
     $tagModel = $this->getModel('Tags');
     $rows = $blogModel->getTaggedBlogs($id);
     $pagination = $blogModel->getPagination();
     $privateBlogCount = 0;
     $teamBlogCount = 0;
     if ($my->id == 0) {
         $privateBlogCount = $tagModel->getTagPrivateBlogCount($id);
     }
     if (!$config->get('main_includeteamblogpost')) {
         $teamBlogCount = $tagModel->getTeamBlogCount($id);
     }
     //for trigger only
     JPluginHelper::importPlugin('easyblog');
     $dispatcher = JDispatcher::getInstance();
     $mainframe = JFactory::getApplication();
     $params = $mainframe->getParams('com_easyblog');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     if (!empty($rows)) {
         $rows = EasyBlogHelper::formatBlog($rows, true, true, true, true);
         for ($i = 0; $i < count($rows); $i++) {
             $row =& $rows[$i];
             $row->category = $blogModel->getCategoryName($row->category_id);
             // $row->readmore		= JText::_('COM_EASYBLOG_CONTINUE_READING');
             if ($config->get('layout_showcomment', false)) {
                 $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('tag', $tag);
     $theme->set('rows', $rows);
     $theme->set('pagination', $pagination);
     $theme->set('currentURL', 'index.php?option=com_easyblog&view=tags&layout=tag&id=' . $tag->id);
     $theme->set('privateBlogCount', $privateBlogCount);
     $theme->set('teamBlogCount', $teamBlogCount);
     echo $theme->fetch('blog.tags.php');
 }
Esempio n. 16
0
 /**
  * Default search view for EasyBlog
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function display($tmpl = null)
 {
     // Set the meta tags for search
     EB::setMeta(META_ID_SEARCH, META_TYPE_SEARCH);
     // Set the page title
     $title = EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_SEARCH_PAGE_TITLE'));
     $this->setPageTitle($title);
     // Set the view's breadcrumbs
     $this->setViewBreadcrumb('search');
     // Get any existing query
     $query = $this->input->get('query', '', 'default');
     $Itemid = $this->input->get('Itemid', '', 'int');
     $posts = array();
     $pagination = '';
     if (!empty($query)) {
         // Get the model
         $model = EB::model('Search');
         $result = $model->getData();
         $total = count($result);
         if ($total > 0) {
             $searchworda = preg_replace('#\\xE3\\x80\\x80#s', ' ', $query);
             $searchwords = preg_split("/\\s+/u", $searchworda);
             $needle = $searchwords[0];
             $searchwords = array_unique($searchwords);
             // var_dump($result[0]);
             // Format the post
             $posts = EB::formatter('list', $result);
             // var_dump($posts[0]);
             // exit;
             // Remove all unecessary codes from the output
             foreach ($posts as &$row) {
                 // var_dump($row->content);
                 // Strip videos
                 $row->intro = EB::videos()->strip($row->intro);
                 $row->content = EB::videos()->strip($row->content);
                 // strip gallery
                 $row->intro = EB::gallery()->strip($row->intro);
                 $row->content = EB::gallery()->strip($row->content);
                 // strip jomsocial album
                 $row->intro = EB::album()->strip($row->intro);
                 $row->content = EB::album()->strip($row->content);
                 // strip audio
                 $row->intro = EB::audio()->strip($row->intro);
                 $row->content = EB::audio()->strip($row->content);
                 // Format the content so that we can apply our search highlighting
                 $content = preg_replace('/\\s+/', ' ', strip_tags($row->content));
                 if (empty($content)) {
                     $content = preg_replace('/\\s+/', ' ', strip_tags($row->intro));
                 }
                 // We only want a snippet of the content
                 $content = JString::substr(strip_tags($content), 0, 350);
                 $pattern = '#(';
                 $x = 0;
                 foreach ($searchwords as $key => $value) {
                     $pattern .= $x == 0 ? '' : '|';
                     $pattern .= preg_quote($value, '#');
                     $x++;
                 }
                 $pattern .= ')#iu';
                 $row->title = preg_replace($pattern, '<span class="search-highlight">\\0</span>', $row->title);
                 $row->content = preg_replace($pattern, '<span class="search-highlight">\\0</span>', $content);
             }
         }
         $pagination = $model->getPagination();
     }
     $this->set('query', $query);
     $this->set('posts', $posts);
     $this->set('pagination', $pagination);
     $this->set('Itemid', $Itemid);
     parent::display('search/default');
 }
Esempio n. 17
0
 /**
  * Displays a list of blog posts on the site filtered by a category.
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function listings()
 {
     // Retrieve sorting options
     $sort = $this->input->get('sort', $this->config->get('layout_postorder'), 'cmd');
     $id = $this->input->get('id', 0, 'int');
     // Try to load the category
     $category = EB::table('Category');
     $category->load($id);
     // If the category isn't found on the site throw an error.
     if (!$id || !$category->id) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_CATEGORY_NOT_FOUND'));
     }
     // Set the meta description for the category
     EB::setMeta($category->id, META_TYPE_CATEGORY);
     // Set a canonical link for the category page.
     $this->canonical($category->getExternalPermalink());
     // Get the privacy
     $privacy = $category->checkPrivacy();
     if ($privacy->allowed || EB::isSiteAdmin() || !$this->my->guest && $this->config->get('main_allowguestsubscribe')) {
         $this->doc->addHeadLink($category->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
         $this->doc->addHeadLink($category->getAtom(), 'alternate', 'rel', array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'));
     }
     // Set views breadcrumbs
     $this->setViewBreadcrumb($this->getName());
     // Set the breadcrumb for this category
     if (!EBR::isCurrentActiveMenu('categories', $category->id)) {
         // Always add the final pathway to the category title.
         $this->setPathway($category->title, '');
     }
     //get the nested categories
     $category->childs = null;
     // Build nested childsets
     EB::buildNestedCategories($category->id, $category, false, true);
     // Parameterize initial subcategories to display. Ability to configure from backend.
     $nestedLinks = '';
     $initialLimit = $this->app->getCfg('list_limit') == 0 ? 5 : $this->app->getCfg('list_limit');
     if (count($category->childs) > $initialLimit) {
         $initialNestedLinks = '';
         $initialRow = new stdClass();
         $initialRow->childs = array_slice($category->childs, 0, $initialLimit);
         EB::accessNestedCategories($initialRow, $initialNestedLinks, '0', '', 'link', ', ');
         $moreNestedLinks = '';
         $moreRow = new stdClass();
         $moreRow->childs = array_slice($category->childs, $initialLimit);
         EB::accessNestedCategories($moreRow, $moreNestedLinks, '0', '', 'link', ', ');
         // Hide more nested links until triggered
         $nestedLinks .= $initialNestedLinks;
         $nestedLinks .= '<span class="more-subcategories-toggle" data-more-categories-link> ' . JText::_('COM_EASYBLOG_AND') . ' <a href="javascript:void(0);">' . JText::sprintf('COM_EASYBLOG_OTHER_SUBCATEGORIES', count($category->childs) - $initialLimit) . '</a></span>';
         $nestedLinks .= '<span class="more-subcategories" style="display: none;" data-more-categories>, ' . $moreNestedLinks . '</span>';
     } else {
         EB::accessNestedCategories($category, $nestedLinks, '0', '', 'link', ', ');
     }
     $catIds = array();
     $catIds[] = $category->id;
     EB::accessNestedCategoriesId($category, $catIds);
     $category->nestedLink = $nestedLinks;
     // Get the category model
     $model = EB::model('Category');
     // Get total posts in this category
     $category->cnt = $model->getTotalPostCount($category->id);
     // Get teamblog posts count
     // $teamBlogCount = $model->getTeamBlogCount($category->id);
     $limit = EB::call('Pagination', 'getLimit', array(EBLOG_PAGINATION_CATEGORIES));
     // Get the posts in the category
     $data = $model->getPosts($catIds, $limit);
     // Get the pagination
     $pagination = $model->getPagination();
     // Get allowed categories
     $allowCat = $model->allowAclCategory($category->id);
     // Format the data that we need
     $posts = array();
     // Ensure that the user is really allowed to view the blogs
     if (!empty($data)) {
         $posts = EB::formatter('list', $data);
     }
     // Check isCategorySubscribed
     $isCategorySubscribed = $model->isCategorySubscribedEmail($category->id, $this->my->email);
     // If this category has a different theme, we need to output it differently
     if (!empty($category->theme)) {
         $this->setTheme($category->theme);
     }
     // Set the page title
     $title = EB::getPageTitle(JText::_($category->title));
     $this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     // Set the return url
     $return = base64_encode($category->getExternalPermalink());
     // Get the pagination
     $pagination = $pagination->getPagesLinks();
     $this->set('allowCat', $allowCat);
     $this->set('category', $category);
     $this->set('sort', $sort);
     $this->set('posts', $posts);
     $this->set('return', $return);
     $this->set('pagination', $pagination);
     // $this->set('teamBlogCount', $teamBlogCount);
     $this->set('privacy', $privacy);
     $this->set('isCategorySubscribed', $isCategorySubscribed);
     parent::display('blogs/categories/item');
 }
Esempio n. 18
0
 function listings()
 {
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $config = EasyBlogHelper::getConfig();
     $theme = $config->get('layout_theme');
     $my = JFactory::getUser();
     $acl = EasyBlogACLHelper::getRuleSet();
     //setting pathway
     $pathway = $mainframe->getPathway();
     $id = JRequest::getInt('id', 0);
     if ($id == 0) {
         echo JText::_('COM_EASYBLOG_TEAMBLOG_INVALID_ID');
         return;
     }
     // set meta tags for teamblog view
     EasyBlogHelper::setMeta($id, META_TYPE_TEAM);
     $team = EasyBlogHelper::getTable('TeamBlog', 'Table');
     $team->load($id);
     $team->avatar = $team->getAvatar();
     $gid = EasyBlogHelper::getUserGids();
     $isMember = $team->isMember($my->id, $gid);
     //check if the logged in user a teammember when the team set to member only.
     if ($team->access == EBLOG_TEAMBLOG_ACCESS_MEMBER) {
         $isMember = $team->isMember($my->id, $gid);
     }
     $team->isMember = $isMember;
     $team->isActualMember = $team->isMember($my->id, $gid, false);
     if ($team->access == EBLOG_TEAMBLOG_ACCESS_EVERYONE || $team->isMember) {
         // Add rss feed link
         $document->addHeadLink($team->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
         $document->addHeadLink($team->getAtom(), 'alternate', 'rel', array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'));
     }
     // check if team description is emtpy or not. if yes, show default message.
     if (empty($team->description)) {
         $team->description = JText::_('COM_EASYBLOG_TEAMBLOG_NO_DESCRIPTION');
     }
     //add the pathway for teamblog
     if (!EasyBlogRouter::isCurrentActiveMenu('teamblog', $team->id)) {
         if (!EasyBlogRouter::isCurrentActiveMenu('teamblog')) {
             $this->setPathway(JText::_('COM_EASYBLOG_TEAMBLOG'), EasyBlogRouter::_('index.php?option=com_easyblog&view=teamblog'));
         }
         $this->setPathway($team->title, '');
     }
     $tbModel = $this->getModel('TeamBlogs');
     $model = $this->getModel('Blog');
     $blogs = $model->getBlogsBy('teamblog', $team->id);
     $blogs = EasyBlogHelper::formatBlog($blogs, true);
     $pagination = $model->getPagination();
     //now get the teams info
     $members = $tbModel->getTeamMembers($team->id);
     $teamMembers = EasyBlogHelper::formatTeamMembers($members);
     $isFeatured = EasyBlogHelper::isFeatured('teamblog', $team->id);
     $title = EasyBlogHelper::getPageTitle($team->title);
     // @task: Set the page title
     parent::setPageTitle($title, $pagination, $config->get('main_pagetitle_autoappend'));
     EasyBlogHelper::storeSession($team->id, 'EASYBLOG_TEAMBLOG_ID');
     $tpl = new CodeThemes();
     $tpl->set('team', $team);
     $tpl->set('teamMembers', $teamMembers);
     $tpl->set('data', $blogs);
     $tpl->set('isFeatured', $isFeatured);
     $tpl->set('pagination', $pagination->getPagesLinks());
     $tpl->set('siteadmin', EasyBlogHelper::isSiteAdmin());
     $tpl->set('currentURL', 'index.php?option=com_easyblog&view=teamblog&layout=listings&id=' . $team->id);
     $tpl->set('config', $config);
     $tpl->set('my', $my);
     $tpl->set('acl', $acl);
     echo $tpl->fetch('blog.teamblogs.php');
 }
Esempio n. 19
0
 /**
  * Determines if the current post is protected
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function isProtected(EasyBlogPost &$blog)
 {
     // Password protection disabled
     if (!$this->config->get('main_password_protect')) {
         return false;
     }
     // Site admin should not be restricted
     if (EB::isSiteAdmin()) {
         return false;
     }
     // Blog does not contain any password protection
     if (empty($blog->blogpassword)) {
         return false;
     }
     // User already entered password
     if ($blog->verifyPassword()) {
         return false;
     }
     // Set the return url to the current url
     $return = base64_encode(JRequest::getURI());
     $category = $blog->getPrimaryCategory();
     $blog->category = $category;
     $blog->categories = $blog->getCategories();
     // Get the blogger object
     $blogger = EB::user($blog->created_by);
     // Set the author object into the table.
     $blog->author = $blogger;
     $this->set('blogger', $blog->author);
     $this->set('return', $return);
     $this->set('blog', $blog);
     $this->set('category', $category);
     parent::display('blogs/entry/default.protected');
     return;
 }
Esempio n. 20
0
 /**
  * Displays a list of blog posts from a specific team
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function listings()
 {
     // Get the team id that is being accessed now
     $id = $this->input->get('id', 0, 'int');
     $team = EB::table('TeamBlog');
     $team->load($id);
     if (!$id || !$team->id) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_TEAMBLOG_INVALID_ID'));
     }
     // set meta tags for teamblog view
     EB::setMeta($id, META_TYPE_TEAM);
     $gid = EB::getUserGids();
     $isMember = $team->isMember($this->my->id, $gid);
     $team->isMember = $isMember;
     $team->isActualMember = $team->isMember($this->my->id, $gid, false);
     // Add rss feed link
     if ($team->access == EBLOG_TEAMBLOG_ACCESS_EVERYONE || $team->isMember) {
         $this->doc->addHeadLink($team->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
         $this->doc->addHeadLink($team->getAtom(), 'alternate', 'rel', array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'));
     }
     // check if team description is emtpy or not. if yes, show default message.
     if (empty($team->description)) {
         $team->description = JText::_('COM_EASYBLOG_TEAMBLOG_NO_DESCRIPTION');
     }
     // Set the breadcrumbs for this view
     $this->setViewBreadcrumb('teamblog');
     $this->setPathway($team->getTitle());
     // Retrieve the model
     $model = EB::model('TeamBlogs');
     $posts = $model->getPosts($team->id);
     $posts = EB::formatter('list', $posts);
     // Get the pagination
     $pagination = $model->getPagination();
     // Retrieve team's information
     $members = $model->getTeamMembers($team->id);
     // Determines if the team blog is featured
     $team->isFeatured = EB::isFeatured('teamblog', $team->id);
     // Set the page title
     $title = EB::getPageTitle($team->title);
     $this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     // Check if subscribed
     $isTeamSubscribed = $model->isTeamSubscribedEmail($team->id, $this->my->email);
     // Get the current url
     $return = $team->getPermalink();
     $this->set('return', $return);
     $this->set('team', $team);
     $this->set('members', $members);
     $this->set('pagination', $pagination->getPagesLinks());
     $this->set('posts', $posts);
     $this->set('isTeamSubscribed', $isTeamSubscribed);
     parent::display('teamblogs/item');
 }
Esempio n. 21
0
 /**
  * Main display for the blog entry view
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function preview($tpl = null)
 {
     // Get the blog post id from the request
     $id = $this->input->get('uid', '', 'default');
     // Load the blog post now
     $post = EB::post($id);
     // After the post is loaded, set it into the cache
     EB::cache()->insert(array($post));
     // If blog id is not provided correctly, throw a 404 error page
     if (!$id || !$post->id) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
     }
     // If the settings requires the user to be logged in, do not allow guests here.
     $post->requiresLoginToRead();
     // Render necessary data on the headers
     $post->renderHeaders();
     // Check if blog is password protected.
     $protected = $this->isProtected($post);
     if ($protected !== false) {
         return;
     }
     // Perform validation checks to see if post is valid
     $exception = $post->checkView();
     if ($exception instanceof EasyBlogException) {
         return JError::raiseError(400, $exception->getMessage());
     }
     // If the viewer is the owner of the blog post, display a proper message
     if ($this->my->id == $post->created_by && !$post->isPublished()) {
         $notice = JText::_('COM_EASYBLOG_ENTRY_BLOG_UNPUBLISHED_VISIBLE_TO_OWNER');
     }
     if (EB::isSiteAdmin() && !$post->isPublished()) {
         $notice = JText::_('COM_EASYBLOG_ENTRY_BLOG_UNPUBLISHED_VISIBLE_TO_ADMIN');
     }
     // Format the post
     $post = EB::formatter('entry', $post);
     // Add bloggers breadcrumbs
     if (!EBR::isCurrentActiveMenu('blogger', $post->author->id) && $this->config->get('layout_blogger_breadcrumb')) {
         $this->setPathway($post->author->getName(), $post->author->getPermalink());
     }
     // Add entry breadcrumb
     if (!EBR::isCurrentActiveMenu('entry', $post->id)) {
         $this->setPathway($post->title, '');
     }
     // Load up the blog model
     $model = EB::model('Blog');
     // Get author's recent posts.
     $recent = $this->getRecentPosts($post);
     // Add canonical URLs for the blog post
     if ($this->config->get('main_canonical_entry')) {
         $this->canonical('index.php?option=com_easyblog&view=entry&id=' . $post->id);
     }
     // Prepare navigation object
     $navigation = $this->prepareNavigation($post);
     // Retrieve Google Adsense codes
     $adsense = EB::adsense()->html($post);
     // If a custom theme is setup for entries in the category, set a different theme
     if (!empty($post->category->theme)) {
         $this->setTheme($post->category->theme);
     }
     // Check if the user subscribed to this post.
     $isBlogSubscribed = $model->isBlogSubscribedEmail($post->id, $this->my->email);
     $theme = EB::template();
     // Prepare related post
     $relatedPosts = array();
     // @TODO: Related posts seems to be missing from the theme file.
     if ($theme->params->get('post_related', true)) {
         $relatedPosts = $model->getRelatedPosts($post->id, $theme->params->get('post_related_limit', 5));
     }
     if (!$post->posttype) {
         $post->posttype = 'standard';
     }
     $this->set('post', $post);
     $this->set('navigation', $navigation);
     $this->set('relatedPosts', $relatedPosts);
     $this->set('recent', $recent);
     $this->set('preview', true);
     $this->set('adsense', $adsense);
     $this->set('isBlogSubscribed', $isBlogSubscribed);
     // Get the menu params associated with this post
     $params = $post->getMenuParams();
     $this->theme->entryParams = $params;
     parent::display('blogs/entry/default');
 }
Esempio n. 22
0
 function calendar($tmpl = null)
 {
     JPluginHelper::importPlugin('easyblog');
     $dispatcher = JDispatcher::getInstance();
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $config = EasyBlogHelper::getConfig();
     $my = JFactory::getUser();
     $acl = EasyBlogACLHelper::getRuleSet();
     //setting pathway
     $pathway = $mainframe->getPathway();
     if (!EasyBlogRouter::isCurrentActiveMenu('archive')) {
         $pathway->addItem(JText::_('COM_EASYBLOG_ARCHIVE_BREADCRUMB'), '');
     }
     EasyBlogHelper::getHelper('Feeds')->addHeaders('index.php?option=com_easyblog&view=archive');
     $menuParams = $mainframe->getParams();
     $defaultYear = $menuParams->get('es_archieve_year', 0);
     $defaultMonth = $menuParams->get('es_archieve_month', 0);
     $archiveYear = JRequest::getVar('archiveyear', $defaultYear, 'REQUEST');
     $archiveMonth = JRequest::getVar('archivemonth', $defaultMonth, 'REQUEST');
     $archiveDay = JRequest::getVar('archiveday', 0, 'REQUEST');
     $itemId = JRequest::getInt('Itemid', 0);
     if (empty($archiveYear) || empty($archiveMonth)) {
         // @task: Set the page title
         $title = EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_ARCHIVE_PAGE_TITLE'));
         parent::setPageTitle($title, false, $config->get('main_pagetitle_autoappend'));
         $tpl = new CodeThemes();
         $tpl->set('itemId', $itemId);
         echo $tpl->fetch('calendar.php');
         return;
     }
     $date = EasyBlogHelper::getDate();
     $sort = 'latest';
     $model = $this->getModel('Archive');
     $year = $model->getArchiveMinMaxYear();
     $data = $model->getArchive($archiveYear, $archiveMonth, $archiveDay);
     $pagination = $model->getPagination();
     $params = $mainframe->getParams('com_easyblog');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $data = EasyBlogHelper::formatBlog($data);
     //if day is empty
     if (empty($archiveDay)) {
         $archiveDay = '01';
         $dateformat = '%B %Y';
         $emptyPostMsg = JText::_('COM_EASYBLOG_ARCHIVE_NO_ENTRIES_ON_MONTH');
     } else {
         $dateformat = '%d %B %Y';
         $emptyPostMsg = JText::_('COM_EASYBLOG_ARCHIVE_NO_ENTRIES_ON_DAY');
     }
     $archiveDay = strlen($archiveDay) < 2 ? '0' . $archiveDay : $archiveDay;
     $viewDate = EasyBlogHelper::getDate($archiveYear . '-' . $archiveMonth . '-' . $archiveDay);
     $formatedDate = $viewDate->toFormat($dateformat);
     $archiveTitle = JText::sprintf('COM_EASYBLOG_ARCHIVE_HEADING_TITLE', $formatedDate);
     // @task: Set the page title
     $title = EasyBlogHelper::getPageTitle(JText::sprintf('COM_EASYBLOG_ARCHIVE_HEADING_TITLE', $formatedDate));
     parent::setPageTitle($title, false, $config->get('main_pagetitle_autoappend'));
     // set meta tags for featured view
     EasyBlogHelper::setMeta(META_ID_ARCHIVE, META_TYPE_VIEW, JText::_('COM_EASYBLOG_ARCHIVE_PAGE_TITLE') . ' - ' . $formatedDate);
     // set meta tags for featured view
     EasyBlogHelper::setMeta(META_ID_ARCHIVE, META_TYPE_VIEW, JText::_('COM_EASYBLOG_ARCHIVE_PAGE_TITLE') . ' - ' . $formatedDate);
     $tpl = new CodeThemes();
     $tpl->set('data', $data);
     $tpl->set('pagination', $pagination->getPagesLinks());
     $tpl->set('siteadmin', EasyBlogHelper::isSiteAdmin());
     $tpl->set('archiveYear', $archiveYear);
     $tpl->set('archiveMonth', $archiveMonth);
     $tpl->set('archiveDay', $archiveDay);
     $tpl->set('config', $config);
     $tpl->set('my', $my);
     $tpl->set('acl', $acl);
     $tpl->set('archiveTitle', $archiveTitle);
     $tpl->set('emptyPostMsg', $emptyPostMsg);
     echo $tpl->fetch('blog.archive.php');
 }
Esempio n. 23
0
 /**
  * Displays blog listings by specific tags on the site
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function tag()
 {
     // Get the tag id
     $id = $this->input->get('id', '', 'default');
     // Add noindex for tags listing by default
     $this->doc->setMetadata('robots', 'noindex,follow');
     // Load the tag object
     $tag = EB::table('Tag');
     $tag->load($id);
     // The tag could be a permalink
     if (!$tag->id) {
         $tag->load($id, true);
     }
     // Set page title
     $this->setPageTitle($tag->getTitle(), '', $this->config->get('main_pagetitle_autoappend'));
     // set meta tags for tags view
     EB::setMeta(META_ID_TAGS, META_TYPE_VIEW, $tag->getTitle() . ' - ' . EB::getPageTitle($this->config->get('main_title')));
     // Set breadcrumb
     if (!EasyBlogRouter::isCurrentActiveMenu('tags')) {
         $this->setPathway(JText::_('COM_EASYBLOG_TAGS_BREADCRUMB'), EBR::_('index.php?option=com_easyblog&view=tags'));
     }
     $this->setPathway($tag->getTitle());
     // Get the blogs model
     $blogModel = EB::model('Blog');
     $tagModel = EB::model('Tags');
     // Get the blog posts now
     $rows = $blogModel->getTaggedBlogs($tag->id, false, '');
     // Get the pagination
     $pagination = $blogModel->getPagination();
     // Get total number of private blog posts
     $privateCount = 0;
     // Get total number of team blog count
     $teamblogCount = 0;
     if ($this->my->guest) {
         $privateCount = $tagModel->getTagPrivateBlogCount($id);
     }
     // Determines if we should get the team blog count
     if (!$this->config->get('main_includeteamblogpost')) {
         $teamblogCount = $tagModel->getTeamBlogCount($id);
     }
     // Format the blog posts using the standard list formatter
     $posts = EB::formatter('list', $rows);
     $return = base64_encode($tag->getPermalink());
     $this->set('return', $return);
     $this->set('tag', $tag);
     $this->set('posts', $posts);
     $this->set('pagination', $pagination);
     $this->set('private', $privateCount);
     $this->set('team', $teamblogCount);
     parent::display('tags/item');
 }
Esempio n. 24
0
 function listings()
 {
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     $config = EasyBlogHelper::getConfig();
     $my = JFactory::getUser();
     $acl = EasyBlogACLHelper::getRuleSet();
     $sort = JRequest::getCmd('sort', $config->get('layout_postorder'));
     $catId = JRequest::getCmd('id', '0');
     $category = EasyBlogHelper::getTable('Category', 'Table');
     $category->load($catId);
     if ($category->id == 0) {
         $category->title = JText::_('COM_EASYBLOG_UNCATEGORIZED');
     }
     // Set the meta description for the category
     EasyBlogHelper::setMeta($category->id, META_TYPE_CATEGORY);
     // Set the meta description for the category
     // $doc->setMetadata( 'description' , strip_tags( $category->description ) );
     //setting pathway
     $pathway = $app->getPathway();
     $privacy = $category->checkPrivacy();
     $addRSS = true;
     if (!$privacy->allowed) {
         if ($my->id == 0 && !$config->get('main_allowguestsubscribe')) {
             $addRSS = false;
         }
     }
     if ($addRSS) {
         // Add rss feed link
         $doc->addHeadLink($category->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
         $doc->addHeadLink($category->getAtom(), 'alternate', 'rel', array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'));
     }
     if (!EasyBlogRouter::isCurrentActiveMenu('categories', $category->id)) {
         if (!EasyBlogRouter::isCurrentActiveMenu('categories')) {
             $this->setPathway(JText::_('COM_EASYBLOG_CATEGORIES_BREADCRUMB'), EasyBlogRouter::_('index.php?option=com_easyblog&view=categories'));
         }
         //add the pathway for category
         $this->setPathway($category->title, '');
     }
     //get the nested categories
     $category->childs = null;
     EasyBlogHelper::buildNestedCategories($category->id, $category, false, true);
     // TODO: Parameterize initial subcategories to display. Ability to configure from backend.
     $nestedLinks = '';
     $initialLimit = $app->getCfg('list_limit') == 0 ? 5 : $app->getCfg('list_limit');
     if (count($category->childs) > $initialLimit) {
         $initialNestedLinks = '';
         $initialRow = new stdClass();
         $initialRow->childs = array_slice($category->childs, 0, $initialLimit);
         EasyBlogHelper::accessNestedCategories($initialRow, $initialNestedLinks, '0', '', 'link', ', ');
         $moreNestedLinks = '';
         $moreRow = new stdClass();
         $moreRow->childs = array_slice($category->childs, $initialLimit);
         EasyBlogHelper::accessNestedCategories($moreRow, $moreNestedLinks, '0', '', 'link', ', ');
         // Hide more nested links until triggered
         $nestedLinks .= $initialNestedLinks;
         $nestedLinks .= '<span class="more-subcategories-toggle"> ' . JText::_('COM_EASYBLOG_AND') . ' <a href="javascript: void(0);onclick="eblog.categories.loadMore( this );">' . JText::sprintf('COM_EASYBLOG_OTHER_SUBCATEGORIES', count($category->childs) - $initialLimit) . '</a></span>';
         $nestedLinks .= '<span class="more-subcategories" style="display: none;">, ' . $moreNestedLinks . '</span>';
     } else {
         EasyBlogHelper::accessNestedCategories($category, $nestedLinks, '0', '', 'link', ', ');
     }
     $catIds = array();
     $catIds[] = $category->id;
     EasyBlogHelper::accessNestedCategoriesId($category, $catIds);
     $category->nestedLink = $nestedLinks;
     $modelC = $this->getModel('Category');
     $category->cnt = $modelC->getTotalPostCount($category->id);
     $modelPT = $this->getModel('PostTag');
     $model = $this->getModel('Blog');
     $modelCat = $this->getModel('Category');
     $data = $model->getBlogsBy('category', $catIds, $sort, null, null, null, null, array(), null, null, null, array(), array(), null, EBLOG_PAGINATION_CATEGORIES);
     $pagination = $model->getPagination();
     $allowCat = $modelCat->allowAclCategory($category->id);
     //for trigger
     $params = $app->getParams('com_easyblog');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     if (!empty($data)) {
         $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;
             }
         }
     }
     $teamBlogCount = $modelCat->getTeamBlogCount($category->id);
     $title = EasyBlogHelper::getPageTitle(JText::_($category->title));
     // @task: Set the page title
     parent::setPageTitle($title, $pagination, $config->get('main_pagetitle_autoappend'));
     $themes = new CodeThemes();
     $themes->set('allowCat', $allowCat);
     $themes->set('category', $category);
     $themes->set('sort', $sort);
     $themes->set('blogs', $data);
     $themes->set('currentURL', 'index.php?option=com_easyblog&view=categories&layout=listings&id=' . $category->id);
     $themes->set('pagination', $pagination->getPagesLinks());
     $themes->set('config', $config);
     $themes->set('teamBlogCount', $teamBlogCount);
     $themes->set('my', $my);
     $themes->set('acl', $acl);
     $themes->set('privacy', $privacy);
     echo $themes->fetch('blog.category.php');
 }
Esempio n. 25
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');
 }
Esempio n. 26
0
 public function getPosts($tmpl = null)
 {
     // Ensure that the user is logged in.
     EB::requireLogin();
     $lang = $this->input->getVar('code', null);
     $langid = $this->input->getVar('codeid', null);
     $search = $this->input->getVar('query', '');
     // Admin might want to display the featured blogs on all pages.
     $start = $this->input->get('start', 0, 'int');
     $limitstart = $this->input->get('limitstart', 0, 'int');
     // conditions
     $options = array();
     $options['langcode'] = $lang;
     if ($search) {
         $options['search'] = $search;
     }
     if (!EB::isSiteAdmin()) {
         $options['userid'] = $this->my->id;
     }
     $model = EB::model('Blog');
     // get results
     $data = $model->getAssociationPosts($options);
     // Get the pagination
     $pagination = $model->getPagination();
     // $pagination = $pagination->getPagesLinks();
     if ($data) {
         EB::cache()->insert($data);
     }
     $posts = EB::formatter('list', $data, false);
     $this->set('posts', $posts);
     $this->set('langcode', $lang);
     $this->set('langid', $langid);
     $this->set('search', $search);
     $this->set('pagination', $pagination);
     parent::display('composer/posts/listing');
 }
Esempio n. 27
0
 /**
  * Displays blog posts created by specific users
  *
  * @since	4.0
  * @access	public
  */
 public function listings()
 {
     // Get sorting options
     $sort = $this->input->get('sort', $this->config->get('layout_postorder'), 'cmd');
     $id = $this->input->get('id', 0, 'int');
     // Load the author object
     $author = EB::user($id);
     // Disallow all users from being viewed
     if (!$this->config->get('main_nonblogger_profile') && !EB::isBlogger($author->id) || !$author->id) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_INVALID_AUTHOR_ID_PROVIDED'));
     }
     // Get the authors acl
     $acl = EB::acl($author->id);
     // Set meta tags for the author if allowed to
     if ($acl->get('allow_seo')) {
         EB::setMeta($author->id, META_TYPE_BLOGGER, true);
     }
     // Set the breadcrumbs
     if (!EBR::isCurrentActiveMenu('blogger', $author->id) && !EBR::isCurrentActiveMenu('blogger')) {
         $this->setPathway(JText::_('COM_EASYBLOG_BLOGGERS_BREADCRUMB'), EB::_('index.php?option=com_easyblog&view=blogger'));
         $this->setPathway($author->getName());
     }
     // Get the current active menu
     $active = $this->app->getMenu()->getActive();
     // Excluded categories
     $excludeCats = array();
     if (isset($active->params)) {
         $excludeCats = $active->params->get('exclusion');
         // Ensure that this is an array
         if (!is_array($excludeCats) && $excludeCats) {
             $excludeCats = array($excludeCats);
         }
     }
     // Get the blogs model now to retrieve our blog posts
     $model = EB::model('Blog');
     // Get blog posts
     $posts = $model->getBlogsBy('blogger', $author->id, $sort, 0, '', false, false, '', false, false, false, $excludeCats);
     $pagination = $model->getPagination();
     // Format the blogs with our standard formatter
     $posts = EB::formatter('list', $posts);
     // Add canonical urls
     $this->canonical('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $author->id);
     // Add authors rss links on the header
     if ($this->config->get('main_rss')) {
         if ($this->config->get('main_feedburner') && $this->config->get('main_feedburnerblogger')) {
             $this->doc->addHeadLink(EB::string()->escape($author->getRssLink()), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
         } else {
             // Add rss feed link
             $this->doc->addHeadLink($author->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
             $this->doc->addHeadLink($author->getAtom(), 'alternate', 'rel', array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'));
         }
     }
     // Set the title of the page
     $title = EB::getPageTitle($author->getName());
     $this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     // Check if subscribed
     $bloggerModel = EB::model('Blogger');
     $isBloggerSubscribed = $bloggerModel->isBloggerSubscribedEmail($author->id, $this->my->email);
     $return = base64_encode($author->getPermalink());
     $this->set('return', $return);
     $this->set('author', $author);
     $this->set('posts', $posts);
     $this->set('sort', $sort);
     $this->set('isBloggerSubscribed', $isBloggerSubscribed);
     parent::display('authors/item');
 }
Esempio n. 28
0
 /**
  * Displays the quickpost layout
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function quickpost()
 {
     // Require user to be logged in
     EB::requireLogin();
     // Test if microblogging is allowed
     if (!$this->config->get('main_microblog')) {
         $this->info->set(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error');
         return $this->app->redirect(EBR::_('index.php?option=com_easyblog&view=dashboard', false));
     }
     // Test ACL if add entry is allowed
     if (!$this->acl->get('add_entry')) {
         return $this->app->redirect(EBR::_('index.php?option=com_easyblog&view=dashboard', false));
     }
     // Set the page title
     $title = EB::getPageTitle(JText::_('COM_EASYBLOG_DASHBOARD_SHARE_A_STORY_TITLE'));
     parent::setPageTitle($title, false, $this->config->get('main_pagetitle_autoappend'));
     // Get active tabs
     $active = $this->input->get('type', 'standard', 'word');
     // Get a list of available auto post sites
     $facebook = EB::oauth()->isUserAssociated('facebook', $this->my->id);
     $twitter = EB::oauth()->isUserAssociated('twitter', $this->my->id);
     $linkedin = EB::oauth()->isUserAssociated('linkedin', $this->my->id);
     // Retrieve existing tags
     $tagsModel = EB::model('Tags');
     $tags = $tagsModel->getTags();
     $this->set('facebook', $facebook);
     $this->set('twitter', $twitter);
     $this->set('linkedin', $linkedin);
     $this->set('active', $active);
     $this->set('tags', $tags);
     parent::display('dashboard/quickpost/default');
 }
Esempio n. 29
0
 function listings()
 {
     JPluginHelper::importPlugin('easyblog');
     $dispatcher = JDispatcher::getInstance();
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $config = EasyBlogHelper::getConfig();
     $my = JFactory::getUser();
     $acl = EasyBlogACLHelper::getRuleSet();
     $sort = JRequest::getCmd('sort', $config->get('layout_postorder'));
     $bId = JRequest::getCmd('id', '0');
     $blogger = EasyBlogHelper::getTable('Profile', 'Table');
     $blogger->load($bId);
     if (!$config->get('main_nonblogger_profile')) {
         if (!EasyBlogHelper::isBlogger($blogger->id)) {
             $redirect = EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false);
             $mainframe->redirect($redirect);
             $mainframe->close();
         }
     }
     // If blogger does not exist, redirect
     if (!$blogger->id) {
         $redirect = EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false);
         $mainframe->redirect($redirect);
         $mainframe->close();
     }
     if ($acl->rules->allow_seo) {
         EasyBlogHelper::setMeta($blogger->id, META_TYPE_BLOGGER, true);
     }
     if (!EasyBlogRouter::isCurrentActiveMenu('blogger', $blogger->id)) {
         if (!EasyBlogRouter::isCurrentActiveMenu('blogger')) {
             $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();
     $data = EasyBlogHelper::formatBlog($data, false, true, true, true);
     $rssURL = EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger&task=rss');
     // @task: Add canonical URLs.
     if ($config->get('main_canonical_entry')) {
         $canonicalUrl = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $blogger->id, false, true, true);
         $document->addCustomTag('<link rel="canonical" href="' . $canonicalUrl . '"/>');
     }
     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;
         }
     }
     if ($config->get('main_rss')) {
         if ($config->get('main_feedburner') && $config->get('main_feedburnerblogger')) {
             $document->addHeadLink(EasyBlogHelper::getHelper('String')->escape($blogger->getRSS()), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
         } else {
             // Add rss feed link
             $document->addHeadLink($blogger->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
             $document->addHeadLink($blogger->getAtom(), 'alternate', 'rel', array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'));
         }
     }
     $title = EasyBlogHelper::getPageTitle($blogger->getName());
     // @task: Set the page title
     parent::setPageTitle($title, $pagination, $config->get('main_pagetitle_autoappend'));
     $theme = new CodeThemes();
     $theme->set('twitterLink', $blogger->getTwitterLink());
     $theme->set('blogger', $blogger);
     $theme->set('sort', $sort);
     $theme->set('blogs', $data);
     $theme->set('pagination', $pagination->getPagesLinks());
     $theme->set('my', $my);
     $theme->set('acl', $acl);
     $theme->set('currentURL', $blogger->getProfileLink());
     $theme->set('showAvatar', false);
     echo $theme->fetch('blog.blogger.php');
     echo EasyBlogHelper::getFBInitScript();
 }
Esempio n. 30
0
 /**
  * Micro blogging layout
  *
  * @since	3.0.7706
  * @access	public
  * @param	null
  * @return 	null
  */
 public function microblog()
 {
     $mainframe = JFactory::getApplication();
     $config = EasyBlogHelper::getConfig();
     $acl = EasyBlogACLHelper::getRuleSet();
     if (!EasyBlogHelper::isLoggedIn()) {
         EasyBlogHelper::showLogin();
         return;
     }
     $my = JFactory::getuser();
     $user = EasyBlogHelper::getTable('Profile', 'Table');
     $user->load($my->id);
     // @rule: Test if microblogging is allowed
     if (!$config->get('main_microblog')) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error');
         JFactory::getApplication()->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard', false));
     }
     // @rule: Test ACL if add entry is allowed
     if (!$acl->rules->add_entry) {
         $mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard', false), JText::_('COM_EASYBLOG_NO_PERMISSION_TO_CREATE_BLOG'));
         $mainframe->close();
     }
     $document = JFactory::getDocument();
     $title = EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_DASHBOARD_SHARE_A_STORY_TITLE'));
     // @task: Set the page title
     parent::setPageTitle($title, false, $config->get('main_pagetitle_autoappend'));
     // Add toolbar to the output
     echo $this->showToolbar(__FUNCTION__, $user);
     // Get active tabs
     $activeType = JRequest::getVar('type', 'text');
     // Add the breadcrumbs
     $breadcrumbs = array(JText::_('COM_EASYBLOG_DASHBOARD_BREADCRUMB_SHARE_STORY') => '');
     // @task: Retrieve existing categories
     $categoryModel = $this->getModel('Categories');
     $categories = EasyBlogHelper::populateCategories('', '', 'select', 'category_id', '', true, true, true);
     // @task: Retrieve existing tags
     $tagsModel = $this->getModel('Tags');
     $tags = $tagsModel->getTags();
     $template = new CodeThemes('dashboard');
     $template->set('activeType', $activeType);
     $template->set('categories', $categories);
     $template->set('breadcrumbs', $breadcrumbs);
     $template->set('tags', $tags);
     echo $template->fetch('dashboard.microblog.php');
 }