当前位置: 首页>>代码示例>>PHP>>正文


PHP EasyBlogHelper::getPrivateCategories方法代码示例

本文整理汇总了PHP中EasyBlogHelper::getPrivateCategories方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogHelper::getPrivateCategories方法的具体用法?PHP EasyBlogHelper::getPrivateCategories怎么用?PHP EasyBlogHelper::getPrivateCategories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EasyBlogHelper的用法示例。


在下文中一共展示了EasyBlogHelper::getPrivateCategories方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkPrivacy

 public function checkPrivacy()
 {
     $obj = new stdClass();
     $obj->allowed = true;
     $obj->message = '';
     $my = JFactory::getUser();
     if ($this->private == '1' && $my->id == 0) {
         $obj->allowed = false;
         $obj->error = EB::privacy()->getErrorHTML();
     } else {
         if ($this->private == '2') {
             $cats = EasyBlogHelper::getPrivateCategories();
             if (in_array($this->id, $cats)) {
                 $obj->allowed = false;
                 $obj->error = JText::_('COM_EASYBLOG_PRIVACY_NOT_AUTHORIZED_ERROR');
             }
         }
     }
     return $obj;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:20,代码来源:category.php

示例2: _buildQuery

 function _buildQuery()
 {
     $db = EasyBlogHelper::db();
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     // used for privacy
     $queryWhere = '';
     $queryExclude = '';
     $queryExcludePending = '';
     $excludeCats = array();
     $isBloggerMode = EasyBlogRouter::isBloggerMode();
     $where = array();
     $where2 = array();
     $text = JRequest::getVar('query');
     $words = explode(' ', $text);
     $wheres = array();
     foreach ($words as $word) {
         $word = $db->Quote('%' . $db->getEscaped($word, true) . '%', false);
         $where[] = 'a.`title` LIKE ' . $word;
         $where[] = 'a.`content` LIKE ' . $word;
         $where[] = 'a.`intro` LIKE ' . $word;
         $where2[] = 't.title LIKE ' . $word;
         $wheres2[] = implode(' OR ', $where2);
         $wheres[] = implode(' OR ', $where);
     }
     $where = '(' . implode(') OR (', $wheres) . ')';
     $where2 = '(' . implode(') OR (', $wheres2) . ')';
     //get teamblogs id.
     $teamBlogIds = '';
     $query = '';
     if ($config->get('main_includeteamblogpost')) {
         $teamBlogIds = EasyBlogHelper::getViewableTeamIds();
         if (count($teamBlogIds) > 0) {
             $teamBlogIds = implode(',', $teamBlogIds);
         }
     }
     // get all private categories id
     $excludeCats = EasyBlogHelper::getPrivateCategories();
     if (!empty($excludeCats)) {
         $queryWhere .= ' AND a.`category_id` NOT IN (' . implode(',', $excludeCats) . ')';
     }
     $jsPostIds = self::getJomSocialPosts();
     if ($config->get('main_includeteamblogpost') && !empty($teamBlogIds)) {
         if (!empty($jsPostIds)) {
             $tmpIds = implode(',', $jsPostIds);
             $queryWhere .= ' AND (u.team_id IN (' . $teamBlogIds . ') OR a.id IN (' . $tmpIds . ') OR a.`issitewide` = ' . $db->Quote('1') . ')';
         } else {
             $queryWhere .= ' AND (u.team_id IN (' . $teamBlogIds . ') OR a.`issitewide` = ' . $db->Quote('1') . ')';
         }
     } else {
         if (!empty($jsPostIds)) {
             $tmpIds = implode(',', $jsPostIds);
             $queryWhere .= ' AND (a.id IN (' . $tmpIds . ') OR a.`issitewide` = ' . $db->Quote('1') . ')';
         } else {
             $queryWhere .= ' AND a.`issitewide` = ' . $db->Quote('1');
         }
     }
     if ($isBloggerMode) {
         $queryWhere .= ' AND a.`created_by`=' . $db->Quote($isBloggerMode);
     }
     $query = 'SELECT a.*, b.`title` AS `category` , CONCAT(a.`content` , a.`intro`) AS text';
     $query .= ' FROM `#__easyblog_post` as a USE INDEX (`easyblog_post_search`)';
     if ($config->get('main_includeteamblogpost')) {
         $query .= ' LEFT JOIN `#__easyblog_team_post` AS u ON a.id = u.post_id';
     }
     $query .= ' LEFT JOIN `#__easyblog_category` AS b';
     $query .= ' 	ON a.category_id = b.id';
     // Always inner join with jos_users and a.created_by so that only valid blogs are loaded
     $query .= ' INNER JOIN ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__users') . ' AS c ON a.`created_by`=c.`id`';
     $query .= ' WHERE (' . $where;
     $query .= ' OR a.`id` IN( ';
     $query .= '		SELECT tp.`post_id` FROM `#__easyblog_tag` AS t ';
     $query .= '		INNER JOIN `#__easyblog_post_tag` AS tp ON tp.`tag_id` = t.`id` ';
     $query .= '		WHERE ' . $where2;
     $query .= ') )';
     if ($my->id < 1) {
         //guest should only see public post.
         $query .= ' AND a.`private` = ' . $db->Quote('0');
     }
     //do not show unpublished post
     $query .= ' AND a.`published` = ' . $db->Quote('1');
     $query .= $queryWhere;
     $query .= ' ORDER BY a.`created` DESC';
     // echo $query;
     return $query;
 }
开发者ID:Tommar,项目名称:vino2,代码行数:86,代码来源:search.php

示例3: getCategories

 public static function getCategories(&$params)
 {
     //blog privacy setting
     $db = EasyBlogHelper::db();
     $my = JFactory::getUser();
     $top_level = 1;
     $onlyTheseCatIds = $params->get('catid', '');
     $mainframe = JFactory::getApplication();
     $order = $params->get('order', 'popular');
     $sort = $params->get('sort', 'desc');
     $count = (int) trim($params->get('count', 0));
     $hideEmptyPost = $params->get('hideemptypost', '0');
     $query = 'SELECT a.`id`, a.`title`, a.`parent_id`, a.`alias`, a.`avatar`, COUNT(b.`id`) AS `cnt`' . ' , ' . $db->quote($top_level) . ' AS level' . ' FROM ' . $db->nameQuote('#__easyblog_category') . ' AS `a`' . ' LEFT JOIN ' . $db->nameQuote('#__easyblog_post') . ' AS b' . ' ON a.`id` = b.`category_id`' . ' AND b.`published` = ' . $db->Quote('1');
     $menu = JFactory::getApplication()->getMenu()->getActive();
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         $menuParams = new JRegistry();
         $menuParams->loadString($menu->params);
     } else {
         $menuParams = new JParameter($menu->params);
     }
     $isBloggerMode = $menuParams->get('standalone_blog');
     if ($isBloggerMode) {
         $uid = $menu->query['id'];
         $query .= ' AND a.`created_by`=' . $db->Quote($uid);
     }
     if ($my->id == 0) {
         $query .= ' AND b.`private` = ' . $db->Quote(BLOG_PRIVACY_PUBLIC);
     }
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         // @rule: When language filter is enabled, we need to detect the appropriate contents
         $filterLanguage = JFactory::getApplication()->getLanguageFilter();
         if ($filterLanguage) {
             $query .= ' AND (';
             $query .= ' b.`language`=' . $db->Quote(JFactory::getLanguage()->getTag());
             $query .= ' OR b.`language`=' . $db->Quote('');
             $query .= ' OR b.`language`=' . $db->Quote('*');
             $query .= ' )';
         }
     }
     $query .= ' WHERE a.`published` = 1';
     // get all private categories id
     $excludeCats = EasyBlogHelper::getPrivateCategories();
     $queryExclude = '';
     if (!empty($excludeCats)) {
         $queryExclude .= ' AND a.`id` NOT IN (';
         for ($i = 0; $i < count($excludeCats); $i++) {
             $queryExclude .= $db->Quote($excludeCats[$i]);
             if (next($excludeCats) !== false) {
                 $queryExclude .= ',';
             }
         }
         $queryExclude .= ')';
     }
     $query .= ' AND a.`parent_id`=' . $db->Quote(0);
     if (!empty($onlyTheseCatIds)) {
         $filterStr = '';
         $filterCats = explode(',', $onlyTheseCatIds);
         foreach ($filterCats as $cat) {
             $filterStr .= empty($filterStr) ? $db->Quote(trim($cat)) : ',' . $db->Quote(trim($cat));
         }
         $query .= ' AND a.`id` IN ( ' . $filterStr . ' )';
     }
     $query .= $queryExclude;
     if (!$hideEmptyPost) {
         $query .= ' GROUP BY a.`id`';
     } else {
         $query .= ' GROUP BY a.`id` HAVING (COUNT(b.`id`) > 0)';
     }
     switch ($order) {
         case 'ordering':
             $orderBy = ' ORDER BY `lft` ';
             break;
         case 'popular':
             $orderBy = ' ORDER BY `cnt` ';
             break;
         case 'alphabet':
             $orderBy = ' ORDER BY a.`title` ';
             break;
         case 'latest':
         default:
             $orderBy = ' ORDER BY a.`created` ';
             break;
     }
     $query .= $orderBy . $sort;
     if (!empty($count)) {
         $query .= ' LIMIT ' . $count;
     }
     // echo $query;exit;
     $db->setQuery($query);
     $result = $db->loadObjectList();
     $categories = array();
     modEasyBlogCategoriesHelper::getChildCategories($result, $params, $categories, ++$top_level);
     // Since running the iteration will invert the ordering, we'll need to reverse it back.
     // $categories		= array_reverse( $categories );
     return $categories;
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:96,代码来源:helper.php

示例4: getTagPrivateBlogCount

 /**
  * *********************************************************************
  * These part of codes will used in tag clod tags.
  * *********************************************************************
  */
 function getTagPrivateBlogCount($tagId)
 {
     $db = EasyBlogHelper::db();
     $queryExclude = '';
     $excludeCats = array();
     $isBloggerMode = EasyBlogRouter::isBloggerMode();
     // get all private categories id
     $excludeCats = EasyBlogHelper::getPrivateCategories();
     if (!empty($excludeCats)) {
         $queryExclude .= ' AND a.`category_id` NOT IN (' . implode(',', $excludeCats) . ')';
     }
     $query = 'select count(1) from `#__easyblog_post` as a';
     $query .= '  inner join `#__easyblog_post_tag` as b';
     $query .= '    on a.`id` = b.`post_id`';
     $query .= '    and b.`tag_id` = ' . $db->Quote($tagId);
     $query .= '  where a.`private` = ' . $db->Quote(BLOG_PRIVACY_PRIVATE);
     if ($isBloggerMode !== false) {
         $query .= '  and a.`created_by` = ' . $db->Quote($isBloggerMode);
     }
     $query .= $queryExclude;
     $db->setQuery($query);
     $result = $db->loadResult();
     return empty($result) ? '0' : $result;
 }
开发者ID:Tommar,项目名称:vino2,代码行数:29,代码来源:tags.php

示例5: getBlogNavigation

 public static function getBlogNavigation($blogId, $creationDate, $typeId = '0', $type = 'sitewide')
 {
     $db = EasyBlogHelper::db();
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     $keys = array('prev', 'next');
     $nav = array();
     $nav['prev'] = null;
     $nav['next'] = null;
     $isBloggerMode = EasyBlogRouter::isBloggerMode();
     $menus = JFactory::getApplication()->getMenu();
     $menu = $menus->getActive();
     $queryInclude = '';
     if (is_object($menu)) {
         $params = EasyBlogHelper::getRegistry();
         $params->load($menu->params);
         $cats = EasyBlogHelper::getCategoryInclusion($params->get('inclusion'));
         if ($cats) {
             if (!is_array($cats)) {
                 $cats = array($cats);
             }
             $queryInclude = ' AND a.`category_id` IN (';
             foreach ($cats as $allowedCat) {
                 $queryInclude .= $db->Quote($allowedCat);
                 if (next($cats) !== false) {
                     $queryInclude .= ',';
                 }
             }
             $queryInclude .= ')';
         }
     }
     // get all private categories id
     $excludeCats = EasyBlogHelper::getPrivateCategories();
     $queryExclude = '';
     if (!empty($excludeCats)) {
         $queryExclude .= ' AND a.`category_id` NOT IN (';
         for ($i = 0; $i < count($excludeCats); $i++) {
             $queryExclude .= $db->Quote($excludeCats[$i]);
             if (next($excludeCats) !== false) {
                 $queryExclude .= ',';
             }
         }
         $queryExclude .= ')';
     }
     foreach ($keys as $key) {
         $query = 'SELECT a.`id`, a.`title`';
         $query .= ' FROM `#__easyblog_post` AS `a`';
         if ($type == 'team' && !empty($typeId)) {
             $query .= ' INNER JOIN `#__easyblog_team_post` AS `b`';
             $query .= ' 	ON a.`id` = b.`post_id`';
         }
         $query .= ' WHERE a.`published` = ' . $db->Quote('1');
         $query .= ' AND a.`ispending` = ' . $db->Quote('0');
         //blog privacy setting
         // @integrations: jomsocial privacy
         $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
         $easysocial = EasyBlogHelper::getHelper('EasySocial');
         if ($config->get('integrations_easysocial_privacy') && $easysocial->exists() && !EasyBlogHelper::isSiteAdmin()) {
             $esPrivacyQuery = $easysocial->buildPrivacyQuery('a');
             $query .= $esPrivacyQuery;
         } else {
             if ($config->get('main_jomsocial_privacy') && JFile::exists($file) && !EasyBlogHelper::isSiteAdmin()) {
                 require_once $file;
                 $my = JFactory::getUser();
                 $jsFriends = CFactory::getModel('Friends');
                 $friends = $jsFriends->getFriendIds($my->id);
                 // Insert query here.
                 $query .= ' AND (';
                 $query .= ' (a.`private`= 0 ) OR';
                 $query .= ' ( (a.`private` = 20) AND (' . $db->Quote($my->id) . ' > 0 ) ) OR';
                 if (empty($friends)) {
                     $query .= ' ( (a.`private` = 30) AND ( 1 = 2 ) ) OR';
                 } else {
                     $query .= ' ( (a.`private` = 30) AND ( a.' . $db->nameQuote('created_by') . ' IN (' . implode(',', $friends) . ') ) ) OR';
                 }
                 $query .= ' ( (a.`private` = 40) AND ( a.' . $db->nameQuote('created_by') . '=' . $my->id . ') )';
                 $query .= ' )';
             } else {
                 //blog privacy setting
                 if ($my->id == 0) {
                     $query .= ' AND a.`private` = ' . $db->Quote(BLOG_PRIVACY_PUBLIC);
                 }
             }
         }
         //include categories
         if (!empty($queryInclude)) {
             $query .= $queryInclude;
         }
         //exclude private categories
         $query .= $queryExclude;
         if ($isBloggerMode !== false) {
             $query .= ' AND a.`created_by` = ' . $db->Quote($isBloggerMode);
         }
         if ($type == 'team' && !empty($typeId)) {
             $query .= ' 	AND b.`team_id` = ' . $db->Quote($typeId);
         } else {
             $query .= ' 	AND a.`issitewide` = ' . $db->Quote('1');
         }
         //language filtering
         if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
//.........这里部分代码省略.........
开发者ID:Tommar,项目名称:vino2,代码行数:101,代码来源:helper.php

示例6: getArchivePostByMonth

 function getArchivePostByMonth($month = '', $year = '', $showPrivate = false)
 {
     $db = EasyBlogHelper::db();
     $user = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     // used for privacy
     $queryWhere = '';
     $queryExclude = '';
     $queryExcludePending = '';
     $excludeCats = array();
     if ($user->id == 0) {
         $showPrivate = false;
     }
     if (!$showPrivate) {
         $excludeCats = EasyBlogHelper::getPrivateCategories();
     }
     //blog privacy setting
     // @integrations: jomsocial privacy
     $privateBlog = '';
     $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
     $easysocial = EasyBlogHelper::getHelper('EasySocial');
     if ($config->get('integrations_easysocial_privacy') && $easysocial->exists() && !EasyBlogHelper::isSiteAdmin()) {
         $esPrivacyQuery = $easysocial->buildPrivacyQuery('a');
         $privateBlog .= $esPrivacyQuery;
     } else {
         if ($config->get('main_jomsocial_privacy') && JFile::exists($file) && !EasyBlogHelper::isSiteAdmin()) {
             require_once $file;
             $jsFriends = CFactory::getModel('Friends');
             $friends = $jsFriends->getFriendIds($user->id);
             // Insert query here.
             $privateBlog .= ' AND (';
             $privateBlog .= ' (a.`private`= 0 ) OR';
             $privateBlog .= ' ( (a.`private` = 20) AND (' . $db->Quote($user->id) . ' > 0 ) ) OR';
             if (empty($friends)) {
                 $privateBlog .= ' ( (a.`private` = 30) AND ( 1 = 2 ) ) OR';
             } else {
                 $privateBlog .= ' ( (a.`private` = 30) AND ( a.' . EasyBlogHelper::getHelper('SQL')->nameQuote('created_by') . ' IN (' . implode(',', $friends) . ') ) ) OR';
             }
             $privateBlog .= ' ( (a.`private` = 40) AND ( a.' . EasyBlogHelper::getHelper('SQL')->nameQuote('created_by') . '=' . $user->id . ') )';
             $privateBlog .= ' )';
         } else {
             if ($user->id == 0) {
                 $privateBlog .= ' AND a.`private` = ' . $db->Quote(0);
             }
         }
     }
     $privateBlog = $showPrivate ? '' : $privateBlog;
     //get teamblogs id.
     $teamBlogIds = '';
     $query = '';
     if ($config->get('main_includeteamblogpost')) {
         $teamBlogIds = EasyBlogHelper::getViewableTeamIds();
         if (count($teamBlogIds) > 0) {
             $teamBlogIds = implode(',', $teamBlogIds);
         }
     }
     if (!empty($excludeCats)) {
         $queryWhere .= ' AND a.`category_id` NOT IN (' . implode(',', $excludeCats) . ')';
     }
     $jsPostIds = self::getJomSocialPosts();
     if ($config->get('main_includeteamblogpost') && !empty($teamBlogIds)) {
         if (!empty($jsPostIds)) {
             $tmpIds = implode(',', $jsPostIds);
             $queryWhere .= ' AND (u.team_id IN (' . $teamBlogIds . ') OR a.id IN (' . $tmpIds . ') OR a.`issitewide` = ' . $db->Quote('1') . ')';
         } else {
             $queryWhere .= ' AND (u.team_id IN (' . $teamBlogIds . ') OR a.`issitewide` = ' . $db->Quote('1') . ')';
         }
     } else {
         if (!empty($jsPostIds)) {
             $tmpIds = implode(',', $jsPostIds);
             $queryWhere .= ' AND (a.id IN (' . $tmpIds . ') OR a.`issitewide` = ' . $db->Quote('1') . ')';
         } else {
             $queryWhere .= ' AND a.`issitewide` = ' . $db->Quote('1');
         }
     }
     $extraSQL = '';
     $blogger = EasyBlogRouter::isBloggerMode();
     if ($blogger !== false) {
         $extraSQL = ' AND a.`created_by` = ' . $db->Quote($blogger);
     }
     $tzoffset = EasyBlogDateHelper::getOffSet(true);
     $query = 'SELECT *, DAY( DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) ) AS day,';
     $query .= ' MONTH( DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) ) AS month,';
     $query .= ' YEAR( DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) ) AS year ';
     $query .= ' FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_post') . ' as a';
     if ($config->get('main_includeteamblogpost')) {
         $query .= ' LEFT JOIN `#__easyblog_team_post` AS u ON a.id = u.post_id';
     }
     $query .= ' WHERE a.`published` = ' . $db->Quote(true) . ' ';
     $query .= $privateBlog . ' ';
     $query .= ' AND (a.`created` > ' . $db->Quote($year . '-' . $month . '-01 00:00:00') . ' AND a.`created` < ' . $db->Quote($year . '-' . $month . '-31 23:59:59') . ') ';
     $query .= $extraSQL . ' ';
     $query .= $queryWhere;
     $query .= ' ORDER BY a.`created` ASC ';
     $db->setQuery($query);
     $row = $db->loadObjectList();
     $postCount = new EasyblogCalendarObject($month, $year);
     if (!empty($row)) {
         foreach ($row as $data) {
             if ($postCount->{$year}->{$month}->{$data->day} == 0) {
//.........这里部分代码省略.........
开发者ID:Tommar,项目名称:vino2,代码行数:101,代码来源:archive.php

示例7: getCategoryTree

 public function getCategoryTree($sort = 'latest')
 {
     $db = EasyBlogHelper::db();
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     $queryExclude = '';
     $excludeCats = array();
     // get all private categories id
     $excludeCats = EasyBlogHelper::getPrivateCategories();
     if (!empty($excludeCats)) {
         $queryExclude .= ' AND a.`id` NOT IN (' . implode(',', $excludeCats) . ')';
     }
     $query = 'SELECT a.*, ';
     $query .= ' ( SELECT COUNT(id) FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_category');
     $query .= ' WHERE lft < a.lft AND rgt > a.rgt AND a.lft != ' . $db->Quote(0) . ' ) AS depth ';
     $query .= ' FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_category') . ' AS a ';
     $query .= ' WHERE a.`published`=' . $db->Quote('1');
     $query .= $queryExclude;
     switch ($sort) {
         case 'ordering':
             $query .= ' ORDER BY `lft`, `ordering`';
             break;
         case 'alphabet':
             $query .= ' ORDER BY `title`, `lft`';
             break;
         case 'latest':
         default:
             $query .= ' ORDER BY `rgt` DESC';
             break;
     }
     // echo $query;
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     $total = count($rows);
     $categories = array();
     for ($i = 0; $i < $total; $i++) {
         $category = EasyBlogHelper::getTable('Category');
         $category->bind($rows[$i]);
         $category->depth = $rows[$i]->depth;
         $categories[] = $category;
     }
     return $categories;
 }
开发者ID:Tommar,项目名称:vino2,代码行数:43,代码来源:categories.php

示例8: getTaggedBlogs

 /**
  * Method to retrieve blog posts based on the given tag id.
  *
  * @access public
  * @param	int		$tagId	The tag id.
  * @return	array	$rows	An array of blog objects.
  */
 function getTaggedBlogs($tagId = 0, $limit = false, $includeCatIds = '')
 {
     if ($tagId == 0) {
         return false;
     }
     $my = JFactory::getUser();
     $db = EasyBlogHelper::db();
     $config = EasyBlogHelper::getConfig();
     if ($limit === false) {
         if ($config->get('layout_listlength') == 0) {
             $limit = $this->getState('limit');
         } else {
             $limit = $config->get('layout_listlength');
         }
     }
     $limitstart = $this->getState('limitstart');
     $isBloggerMode = EasyBlogRouter::isBloggerMode();
     $queryExclude = '';
     $excludeCats = array();
     $isJSGrpPluginInstalled = false;
     $isJSGrpPluginInstalled = JPluginHelper::isEnabled('system', 'groupeasyblog');
     $isEventPluginInstalled = JPluginHelper::isEnabled('system', 'eventeasyblog');
     $isJSInstalled = false;
     // need to check if the site installed jomsocial.
     if (JFile::exists(JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php')) {
         $isJSInstalled = true;
     }
     $includeJSGrp = $isJSGrpPluginInstalled && $isJSInstalled ? true : false;
     $includeJSEvent = $isEventPluginInstalled && $isJSInstalled ? true : false;
     $jsGrpPostIds = '';
     $jsEventPostIds = '';
     if ($includeJSEvent) {
         $queryEvent = 'SELECT ' . EasyBlogHelper::getHelper('SQL')->nameQuote('post_id') . ' FROM';
         $queryEvent .= ' ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_external') . ' AS ' . EasyBlogHelper::getHelper('SQL')->nameQuote('a');
         $queryEvent .= ' INNER JOIN' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__community_events') . ' AS ' . EasyBlogHelper::getHelper('SQL')->nameQuote('b');
         $queryEvent .= ' ON ' . EasyBlogHelper::getHelper('SQL')->nameQuote('a') . '.uid = ' . EasyBlogHelper::getHelper('SQL')->nameQuote('b') . '.id';
         $queryEvent .= ' AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('a') . '.' . EasyBlogHelper::getHelper('SQL')->nameQuote('source') . '=' . $db->Quote('jomsocial.event');
         $queryEvent .= ' WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('b') . '.' . EasyBlogHelper::getHelper('SQL')->nameQuote('permission') . '=' . $db->Quote(0);
         $db->setQuery($queryEvent);
         $jsEventPostIds = $db->loadResultArray();
         if (!empty($excludeBlogs) && !empty($jsEventPostIds)) {
             $jsEventPostIds = array_diff($jsEventPostIds, $excludeBlogs);
         }
     }
     if ($includeJSGrp) {
         $queryJSGrp = 'select `post_id` from `#__easyblog_external_groups` as exg inner join `#__community_groups` as jsg';
         $queryJSGrp .= '      on exg.group_id = jsg.id ';
         $queryJSGrp .= '      where jsg.`approvals` = 0';
         $db->setQuery($queryJSGrp);
         $jsGrpPostIds = $db->loadResultArray();
         if (!empty($excludeBlogs) && !empty($jsGrpPostIds)) {
             $jsGrpPostIds = array_diff($jsGrpPostIds, $excludeBlogs);
         }
     }
     //get teamblogs id.
     if ($config->get('main_includeteamblogpost')) {
         $teamBlogIds = EasyBlogHelper::getViewableTeamIds();
         if (count($teamBlogIds) > 0) {
             $teamBlogIds = implode(',', $teamBlogIds);
         }
     }
     // get all private categories id
     $excludeCats = EasyBlogHelper::getPrivateCategories();
     if (!empty($excludeCats)) {
         $queryExclude .= ' AND b.`category_id` NOT IN (' . implode(',', $excludeCats) . ')';
     }
     $query = 'SELECT b.*, c.`title` as `category`';
     if ($config->get('main_includeteamblogpost') && !empty($teamBlogIds)) {
         $query .= ' ,u.`team_id`';
     }
     $query .= ' FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_post_tag') . ' AS a ';
     $query .= ' INNER JOIN ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_post') . ' AS b ';
     $query .= ' ON a.post_id=b.id ';
     $query .= ' LEFT JOIN `#__easyblog_category` AS c';
     $query .= ' ON b.category_id = c.id';
     if ($config->get('main_includeteamblogpost') && !empty($teamBlogIds)) {
         $query .= ' LEFT JOIN `#__easyblog_team_post` AS u ON b.id = u.post_id';
     }
     $query .= ' WHERE a.tag_id = ' . $db->Quote($tagId);
     $query .= ' AND b.`published` = ' . $db->Quote('1');
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         // @rule: When language filter is enabled, we need to detect the appropriate contents
         $filterLanguage = JFactory::getApplication()->getLanguageFilter();
         if ($filterLanguage) {
             $query .= ' AND (';
             $query .= ' b.`language`=' . $db->Quote(JFactory::getLanguage()->getTag());
             $query .= ' OR b.`language`=' . $db->Quote('');
             $query .= ' OR b.`language`=' . $db->Quote('*');
             $query .= ' )';
         }
     }
     $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
     //blog privacy setting
//.........这里部分代码省略.........
开发者ID:Tommar,项目名称:vino2,代码行数:101,代码来源:blog.php


注:本文中的EasyBlogHelper::getPrivateCategories方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。