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


PHP EB::contributor方法代码示例

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


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

示例1: getTaggedBlogs

 /**
  * Retrieves a list of blog posts associated with a particular tag
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getTaggedBlogs($tagId = 0, $limit = false, $includeCatIds = '', $sorting = '')
 {
     if (!$tagId) {
         return false;
     }
     $my = JFactory::getUser();
     $db = EB::db();
     $config = EasyBlogHelper::getConfig();
     $catAccess = array();
     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;
     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 = '';
     // contribution type sql
     $contributor = EB::contributor();
     $contributeSQL = ' AND ( (b.`source_type` = ' . $db->Quote(EASYBLOG_POST_SOURCE_SITEWIDE) . ') ';
     if ($config->get('main_includeteamblogpost')) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_TEAM, 'b');
     }
     if ($includeJSEvent) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_EVENT, 'b');
     }
     if ($includeJSGrp) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_GROUP, 'b');
     }
     if (EB::easysocial()->exists()) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_GROUP, 'b');
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_EVENT, 'b');
     }
     $contributeSQL .= ')';
     //get teamblogs id.
     $query = 'SELECT b.*';
     $query .= ' FROM ' . $db->nameQuote('#__easyblog_post_tag') . ' AS a ';
     $query .= ' INNER JOIN ' . $db->nameQuote('#__easyblog_post') . ' AS b ';
     $query .= ' ON a.post_id=b.id ';
     $query .= ' WHERE a.' . $db->quoteName('tag_id') . ' = ' . $db->Quote($tagId);
     $query .= ' AND b.' . $db->quoteName('published') . ' = ' . $db->Quote(EASYBLOG_POST_PUBLISHED);
     $query .= ' AND b.' . $db->quoteName('state') . '=' . $db->Quote(EASYBLOG_POST_NORMAL);
     $query .= $contributeSQL;
     // @rule: When language filter is enabled, we need to detect the appropriate contents
     $filterLanguage = JFactory::getApplication()->getLanguageFilter();
     if ($filterLanguage) {
         $query .= EBR::getLanguageQuery('AND', 'b.language');
     }
     $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
     //blog privacy setting
     if ($config->get('main_jomsocial_privacy') && JFile::exists($file) && !EasyBlogHelper::isSiteAdmin()) {
         require_once $file;
         $jsFriends = CFactory::getModel('Friends');
         $friends = $jsFriends->getFriendIds($my->id);
         array_push($friends, $my->id);
         // Insert query here.
         $query .= ' AND (';
         $query .= ' (b.`access`= 0 ) OR';
         $query .= ' ( (b.`access` = 20) AND (' . $db->Quote($my->id) . ' > 0 ) ) OR';
         if (empty($friends)) {
             $query .= ' ( (b.`access` = 30) AND ( 1 = 2 ) ) OR';
         } else {
             $query .= ' ( (b.`access` = 30) AND ( b.' . $db->nameQuote('created_by') . ' IN (' . implode(',', $friends) . ') ) ) OR';
         }
         $query .= ' ( (b.`access` = 40) AND ( b.' . $db->nameQuote('created_by') . '=' . $my->id . ') )';
         $query .= ' )';
     } else {
         if ($my->id == 0) {
             $query .= ' AND b.`access` = ' . $db->Quote(BLOG_PRIVACY_PUBLIC);
         }
     }
     if ($isBloggerMode !== false) {
         $query .= ' AND b.`created_by` = ' . $db->Quote($isBloggerMode);
     }
     $includeCats = array();
     $includeCatIds = trim($includeCatIds);
     if (!empty($includeCatIds)) {
         $includeCats = explode(',', $includeCatIds);
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:blog.php

示例2: getResult

 public function getResult($text, $phrase, $ordering)
 {
     $config = EasyBlogHelper::getConfig();
     $my = JFactory::getUser();
     $db = EasyBlogHelper::db();
     $where = array();
     $where2 = array();
     // used for privacy
     $queryWhere = '';
     $queryExclude = '';
     $queryExcludePending = '';
     $excludeCats = array();
     switch ($phrase) {
         case 'exact':
             $where[] = 'a.`title` LIKE ' . $db->Quote('%' . $db->escape($text, true) . '%', false);
             $where[] = 'a.`content` LIKE ' . $db->Quote('%' . $db->escape($text, true) . '%', false);
             $where[] = 'a.`intro` LIKE ' . $db->Quote('%' . $db->escape($text, true) . '%', false);
             $where2 = '( t.title LIKE ' . $db->Quote('%' . $db->escape($text, true) . '%', false) . ')';
             $where = '(' . implode(') OR (', $where) . ')';
             break;
         case 'all':
         case 'any':
         default:
             $words = explode(' ', $text);
             $wheres = array();
             $where2 = array();
             $wheres2 = array();
             foreach ($words as $word) {
                 $word = $db->Quote('%' . $db->escape($word, true) . '%', false);
                 $where[] = 'a.`title` LIKE ' . $word;
                 $where[] = 'a.`content` LIKE ' . $word;
                 $where[] = 'a.`intro` LIKE ' . $word;
                 $where2[] = 't.title LIKE ' . $word;
                 $wheres[] = implode(' OR ', $where);
                 $wheres2[] = implode(' OR ', $where2);
             }
             $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
             $where2 = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres2) . ')';
             break;
     }
     $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;
     //get teamblogs id.
     $query = '';
     // contribution type sql
     $contributor = EB::contributor();
     $contributeSQL = ' AND ( (a.`source_type` = ' . $db->Quote(EASYBLOG_POST_SOURCE_SITEWIDE) . ') ';
     if ($config->get('main_includeteamblogpost')) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_TEAM, 'a');
     }
     if ($includeJSEvent) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_EVENT, 'a');
     }
     if ($includeJSGrp) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_GROUP, 'a');
     }
     if (EB::easysocial()->exists()) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_GROUP, 'a');
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_EVENT, 'a');
     }
     $contributeSQL .= ')';
     $queryWhere .= $contributeSQL;
     // category access here
     $catLib = EB::category();
     $catAccessSQL = $catLib->genAccessSQL('a.`id`');
     $queryWhere .= ' AND (' . $catAccessSQL . ')';
     $query = 'SELECT a.*, CONCAT(a.`content` , a.`intro`) AS text , "2" as browsernav';
     $query .= ' FROM `#__easyblog_post` as a USE INDEX (`easyblog_post_searchnew`) ';
     $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 .= '))';
     $my = JFactory::getUser();
     if ($my->id == 0) {
         //guest should only see public post.
         $query .= ' AND a.`access` = ' . $db->Quote('0');
     }
     //do not show unpublished post
     $query .= ' AND a.`published` = ' . $db->Quote(EASYBLOG_POST_PUBLISHED);
     $query .= ' AND a.`state` = ' . $db->Quote(EASYBLOG_POST_NORMAL);
     $query .= $queryWhere;
     switch ($ordering) {
         case 'oldest':
             $query .= ' ORDER BY a.`created` ASC';
             break;
         case 'newest':
             $query .= ' ORDER BY a.`created` DESC';
             break;
     }
     $db->setQuery($query);
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:easyblog.php

示例3: getPosts

 /**
  * Retrieve a list of blog posts from a specific list of categories
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function getPosts($categories, $limit = null)
 {
     $db = EB::db();
     $my = JFactory::getUser();
     $config = EB::config();
     // Determines if this is currently on blogger mode
     $isBloggerMode = EasyBlogRouter::isBloggerMode();
     // use in generating category access sql
     $catAccess = array();
     $catAccess['include'] = $categories;
     $isJSGrpPluginInstalled = false;
     $isJSGrpPluginInstalled = JPluginHelper::isEnabled('system', 'groupeasyblog');
     $isEventPluginInstalled = JPluginHelper::isEnabled('system', 'eventeasyblog');
     $isJSInstalled = false;
     // need to check if the site installed jomsocial.
     if (EB::jomsocial()->exists()) {
         $isJSInstalled = true;
     }
     $includeJSGrp = $isJSGrpPluginInstalled && $isJSInstalled ? true : false;
     $includeJSEvent = $isEventPluginInstalled && $isJSInstalled ? true : false;
     // contribution type sql
     $contributor = EB::contributor();
     $contributeSQL = ' AND ( (a.`source_type` = ' . $db->Quote(EASYBLOG_POST_SOURCE_SITEWIDE) . ') ';
     if ($config->get('main_includeteamblogpost')) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_TEAM, 'a');
     }
     if ($includeJSEvent) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_EVENT, 'a');
     }
     if ($includeJSGrp) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_GROUP, 'a');
     }
     // Test if easysocial exists on the site
     if (EB::easysocial()->exists()) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_GROUP, 'a');
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_EVENT, 'a');
     }
     $contributeSQL .= ')';
     $query = array();
     $query[] = 'SELECT a.* FROM ' . $db->quoteName('#__easyblog_post') . ' AS a';
     // Build the WHERE clauses
     $query[] = 'WHERE a.' . $db->quoteName('published') . '=' . $db->Quote(EASYBLOG_POST_PUBLISHED);
     $query[] = 'AND a.' . $db->quoteName('state') . '=' . $db->Quote(EASYBLOG_POST_NORMAL);
     // If this is on blogger mode, fetch items created by the current author only
     if ($isBloggerMode !== false) {
         $query[] = ' AND a.' . $db->quoteName('created_by') . '=' . $db->Quote($isBloggerMode);
     } else {
         // Get the author id based on the category menu
         $authorId = EB::getCategoryMenuBloggerId();
         if ($authorId) {
             $query[] = ' AND a.' . $db->quoteName('created_by') . '=' . $db->Quote($authorId);
         }
     }
     //sql for blog contribution
     $query[] = $contributeSQL;
     // sql for category access
     $catLib = EB::category();
     $catAccessSQL = $catLib->genAccessSQL('a.`id`', $catAccess);
     $query[] = 'AND (' . $catAccessSQL . ')';
     // If user is a guest, ensure that they can really view the blog post
     if ($this->my->guest) {
         $query[] = 'AND a.' . $db->quoteName('access') . '=' . $db->Quote(BLOG_PRIVACY_PUBLIC);
     }
     // Ensure that the blog posts is available site wide
     // $query[] = 'AND a.' . $db->quoteName('source_id') . '=' . $db->Quote('0');
     // Filter by language
     $language = EB::getCurrentLanguage();
     if ($language) {
         $query[] = 'AND (a.' . $db->quoteName('language') . '=' . $db->Quote($language) . ' OR a.' . $db->quoteName('language') . '=' . $db->Quote('*') . ' OR a.' . $db->quoteName('language') . '=' . $db->Quote('') . ')';
     }
     // Ordering options
     $ordering = $config->get('layout_postsort', 'DESC');
     // Order the posts
     $query[] = 'ORDER BY a.' . $db->quoteName('created') . ' ' . $ordering;
     // Set the pagination
     if (!is_null($limit)) {
         // Glue back the sql queries into a single string.
         $queryCount = implode(' ', $query);
         $queryCount = str_ireplace('SELECT a.*', 'SELECT COUNT(1)', $queryCount);
         $db->setQuery($queryCount);
         $count = $db->loadResult();
         $limit = $limit == 0 ? $this->getState('limit') : $limit;
         $limitstart = $this->input->get('limitstart', $this->getState('limitstart'), 'int');
         // Set the limit
         $query[] = 'LIMIT ' . $limitstart . ',' . $limit;
         $this->_pagination = EB::pagination($count, $limitstart, $limit);
     }
     // Glue back the sql queries into a single string.
     $query = implode(' ', $query);
     // Debug
     // echo str_ireplace('#__', 'jos_', $query);exit;
     $db->setQuery($query);
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:category.php

示例4: getArchivePostByMonth

 /**
  * Retrieves a list of blog posts by specific month
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getArchivePostByMonth($month = '', $year = '', $showPrivate = false)
 {
     $db = EB::db();
     $user = JFactory::getUser();
     $config = EB::config();
     // used for privacy
     $queryWhere = '';
     $queryExclude = '';
     $queryExcludePending = '';
     $excludeCats = array();
     if ($user->id == 0) {
         $showPrivate = false;
     }
     // Blog privacy setting
     // @integrations: jomsocial privacy
     $privateBlog = '';
     if (EB::easysocial()->exists() && $config->get('integrations_easysocial_privacy') && !EB::isSiteAdmin()) {
         $esPrivacyQuery = EB::easysocial()->buildPrivacyQuery('a');
         $privateBlog .= $esPrivacyQuery;
     } else {
         if ($config->get('main_jomsocial_privacy') && EB::jomsocial()->exists() && !EB::isSiteAdmin()) {
             $friendsModel = CFactory::getModel('Friends');
             $friends = $friendsModel->getFriendIds($user->id);
             // Insert query here.
             $privateBlog .= ' AND (';
             $privateBlog .= ' (a.`access`= 0 ) OR';
             $privateBlog .= ' ( (a.`access` = 20) AND (' . $db->Quote($user->id) . ' > 0 ) ) OR';
             if (!$friends) {
                 $privateBlog .= ' ( (a.`access` = 30) AND ( 1 = 2 ) ) OR';
             } else {
                 $privateBlog .= ' ( (a.`access` = 30) AND ( a.' . $db->nameQuote('created_by') . ' IN (' . implode(',', $friends) . ') ) ) OR';
             }
             $privateBlog .= ' ( (a.`access` = 40) AND ( a.' . $db->nameQuote('created_by') . '=' . $user->id . ') )';
             $privateBlog .= ' )';
         } else {
             if ($user->id == 0) {
                 $privateBlog .= ' AND a.`access` = ' . $db->Quote(0);
             }
         }
     }
     // Join the query ?
     $privateBlog = $showPrivate ? '' : $privateBlog;
     $isJSGrpPluginInstalled = false;
     $isJSGrpPluginInstalled = JPluginHelper::isEnabled('system', 'groupeasyblog');
     $isEventPluginInstalled = JPluginHelper::isEnabled('system', 'eventeasyblog');
     $isJSInstalled = false;
     // need to check if the site installed jomsocial.
     if (EB::jomsocial()->exists()) {
         $isJSInstalled = true;
     }
     $includeJSGrp = $isJSGrpPluginInstalled && $isJSInstalled ? true : false;
     $includeJSEvent = $isEventPluginInstalled && $isJSInstalled ? true : false;
     // contribution type sql
     $contributor = EB::contributor();
     $contributeSQL = ' AND ( (a.`source_type` = ' . $db->Quote(EASYBLOG_POST_SOURCE_SITEWIDE) . ') ';
     if ($config->get('main_includeteamblogpost')) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_TEAM, 'a');
     }
     if ($includeJSEvent) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_EVENT, 'a');
     }
     if ($includeJSGrp) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_GROUP, 'a');
     }
     if (EB::easysocial()->exists()) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_GROUP, 'a');
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_EVENT, 'a');
     }
     $contributeSQL .= ')';
     $queryWhere .= $contributeSQL;
     //get teamblogs id.
     $query = '';
     $extraSQL = '';
     // If this is on blogger mode, we need to only pick items from the blogger.
     $blogger = EBR::isBloggerMode();
     if ($blogger !== false) {
         $extraSQL = ' AND a.`created_by` = ' . $db->Quote($blogger);
     }
     $tzoffset = EB::date()->getOffSet(true);
     $query = 'SELECT a.*, 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 ' . $db->nameQuote('#__easyblog_post') . ' as a';
     $query .= ' WHERE a.`published` = ' . $db->Quote(EASYBLOG_POST_PUBLISHED) . ' ';
     $query .= ' AND a.' . $db->quoteName('state') . ' = ' . $db->Quote(EASYBLOG_POST_NORMAL) . ' ';
     $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') . ') ';
     // If do not display private posts, we need to append additional queries here.
     if (!$showPrivate) {
         // sql for category access
         $catLib = EB::category();
         $catAccessSQL = $catLib->genAccessSQL('a.`id`');
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:archive.php

示例5: preloadPosts

 public function preloadPosts($catIds)
 {
     $db = EB::db();
     $config = EB::config();
     $limit = EB::call('Pagination', 'getLimit', array(EBLOG_PAGINATION_CATEGORIES));
     // Determines if this is currently on blogger mode
     $isBloggerMode = EasyBlogRouter::isBloggerMode();
     $query = array();
     $i = 1;
     foreach ($catIds as $cid => $cIds) {
         $p = 'p' . $i;
         $a = 'a' . $i;
         $f = 'f' . $i;
         $isJSGrpPluginInstalled = false;
         $isJSGrpPluginInstalled = JPluginHelper::isEnabled('system', 'groupeasyblog');
         $isEventPluginInstalled = JPluginHelper::isEnabled('system', 'eventeasyblog');
         $isJSInstalled = false;
         // need to check if the site installed jomsocial.
         if (EB::jomsocial()->exists()) {
             $isJSInstalled = true;
         }
         $includeJSGrp = $isJSGrpPluginInstalled && $isJSInstalled ? true : false;
         $includeJSEvent = $isEventPluginInstalled && $isJSInstalled ? true : false;
         // contribution type sql
         $contributor = EB::contributor();
         $contributeSQL = " AND ( ({$p}.`source_type` = " . $db->Quote(EASYBLOG_POST_SOURCE_SITEWIDE) . ") ";
         if ($config->get('main_includeteamblogpost')) {
             $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_TEAM, $p);
         }
         if ($includeJSEvent) {
             $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_EVENT, $p);
         }
         if ($includeJSGrp) {
             $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_GROUP, $p);
         }
         // Test if easysocial exists on the site
         if (EB::easysocial()->exists()) {
             $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_GROUP, $p);
             $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_EVENT, $p);
         }
         $contributeSQL .= ")";
         $tmp = "(select {$p}.*, " . $db->Quote($cid) . " as `category_id`, {$f}.`id` as `featured`";
         $tmp .= "\tfrom `#__easyblog_post` as {$p}";
         $tmp .= "\t\tinner join `#__easyblog_post_category` as {$a} on {$p}.`id` = {$a}.`post_id`";
         $tmp .= " LEFT JOIN `#__easyblog_featured` AS {$f}";
         $tmp .= " \tON {$p}.`id` = {$f}.`content_id` AND {$f}.`type` = " . $db->Quote('post');
         if (count($cIds) == 1) {
             $tmp .= " where {$a}.`category_id` = " . $db->Quote($cIds[0]);
         } else {
             $tmp .= " where {$a}.`category_id` IN (" . implode(',', $cIds) . ")";
         }
         $tmp .= " and {$p}.`published` = " . $db->Quote(EASYBLOG_POST_PUBLISHED);
         $tmp .= " and {$p}.`state` = " . $db->Quote(EASYBLOG_POST_NORMAL);
         if ($isBloggerMode !== false) {
             $tmp .= " AND {$p}." . $db->qn('created_by') . " = " . $db->Quote($isBloggerMode);
         } else {
             // Get the author id based on the category menu
             $authorId = EB::getCategoryMenuBloggerId();
             if ($authorId) {
                 $tmp .= " AND {$p}." . $db->qn('created_by') . " = " . $db->Quote($authorId);
             }
         }
         // If user is a guest, ensure that they can really view the blog post
         if ($this->my->guest) {
             $tmp .= " AND {$p}." . $db->qn('access') . " = " . $db->Quote(BLOG_PRIVACY_PUBLIC);
         }
         // Ensure that the blog posts is available site wide
         $tmp .= $contributeSQL;
         // $tmp .= " AND $p." . $db->qn('source_id') . " = " . $db->Quote("0");
         // Filter by language
         $language = EB::getCurrentLanguage();
         if ($language) {
             $tmp .= " AND ({$p}." . $db->qn('language') . "=" . $db->Quote($language) . " OR {$p}." . $db->qn('language') . "=" . $db->Quote('*') . " OR {$p}." . $db->qn('language') . "=" . $db->Quote('') . ")";
         }
         $tmp .= " order by {$p}.`created` desc";
         $tmp .= " limit " . $limit . ")";
         $query[] = $tmp;
         $i++;
     }
     $query = implode(' UNION ALL ', $query);
     // echo $query;exit;
     $db->setQuery($query);
     $results = $db->loadObjectList();
     $posts = array();
     if ($results) {
         foreach ($results as $row) {
             $posts[$row->category_id][] = $row;
         }
     }
     return $posts;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:91,代码来源:categories.php

示例6: getMostCommentedPost

 public static function getMostCommentedPost(&$params)
 {
     $mainframe = JFactory::getApplication();
     $db = EB::db();
     $my = JFactory::getUser();
     $config = EB::config();
     $count = (int) trim($params->get('count', 0));
     $categories = $params->get('catid');
     $catAccess = array();
     // Get the category ID if any from the module setting
     if (!empty($categories)) {
         $categories = explode(',', $categories);
     }
     // Respect inclusion categories
     if (!empty($categories)) {
         if (!is_array($categories)) {
             $categories = array($categories);
         }
         $catAccess['include'] = $categories;
     }
     $showprivate = $params->get('showprivate', true);
     $showcomment = $params->get('showlatestcomment', true);
     $query = 'SELECT a.*, count(b.' . $db->quoteName('id') . ') as ' . $db->quoteName('comment_count');
     if ($showcomment) {
         $query .= ', c.' . $db->quoteName('id') . ' as ' . $db->quoteName('comment_id') . ', c.' . $db->quoteName('comment') . ', c.' . $db->quoteName('created_by') . ' as ' . $db->quoteName('commentor') . ', c.' . $db->quoteName('title') . ' as ' . $db->quoteName('comment_title') . ', c.' . $db->quoteName('name') . ' as ' . $db->quoteName('commentor_name');
     }
     $query .= ' FROM ' . $db->quoteName('#__easyblog_post') . ' AS a';
     $query .= '  LEFT JOIN ' . $db->quoteName('#__easyblog_comment') . ' AS b ON a.' . $db->quoteName('id') . ' = b.' . $db->quoteName('post_id');
     if ($showcomment) {
         $query .= '  LEFT JOIN ' . $db->quoteName('#__easyblog_comment') . ' AS c ON a.' . $db->quoteName('id') . ' = c.' . $db->quoteName('post_id');
         $query .= '    AND c.' . $db->quoteName('id') . ' = (SELECT MAX(d.' . $db->quoteName('id') . ') FROM ' . $db->quoteName('#__easyblog_comment') . ' AS d WHERE c.' . $db->quoteName('post_id') . ' = d.' . $db->quoteName('post_id') . ')';
     }
     $query .= ' WHERE a.' . $db->quoteName('published') . ' = ' . $db->Quote(EASYBLOG_POST_PUBLISHED);
     $query .= ' AND a.' . $db->quoteName('state') . ' = ' . $db->Quote(EASYBLOG_POST_NORMAL);
     if (!$showprivate) {
         $query .= ' AND a.' . $db->quoteName('access') . ' = ' . $db->Quote('0');
     }
     // get teamblogs id.
     // contribution type sql
     $contributor = EB::contributor();
     $contributeSQL = ' AND ( (a.`source_type` = ' . $db->Quote(EASYBLOG_POST_SOURCE_SITEWIDE) . ') ';
     if ($config->get('main_includeteamblogpost')) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_TEAM, 'a');
     }
     $contributeSQL .= ')';
     $query .= $contributeSQL;
     // category access here
     $catLib = EB::category();
     $catAccessSQL = $catLib->genAccessSQL('a.`id`', $catAccess);
     $query .= ' AND (' . $catAccessSQL . ')';
     $query .= ' GROUP BY a.' . $db->quoteName('id');
     $query .= ' HAVING (' . $db->quoteName('comment_count') . ' > 0)';
     $query .= ' ORDER BY ' . $db->quoteName('comment_count') . ' DESC';
     if ($count > 0) {
         $query .= ' LIMIT ' . $count;
     }
     $db->setQuery($query);
     $posts = $db->loadObjectList();
     // process item
     $posts = EB::modules()->processItems($posts, $params);
     return $posts;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:62,代码来源:helper.php

示例7: renderManager


//.........这里部分代码省略.........
         $category->id = (int) $row->id;
         $category->title = $row->title;
         $category->parent_id = (int) $row->parent_id;
         $params = new JRegistry($row->params);
         $category->tags = $params->get('tags');
         if (!$category->tags) {
             $category->tags = array();
         } else {
             $tags = explode(',', $category->tags);
             for ($i = 0; $i < count($tags); $i++) {
                 $tags[$i] = JString::trim($tags[$i]);
             }
             $category->tags = implode(',', $tags);
         }
         // Cross check if this category is selected
         $category->selected = in_array($category->id, $selectedCategories);
         // check if this is a primary category or not
         $category->isprimary = $category->id == $primaryCategory->id;
         $categories[] = $category;
     }
     // Prepare tags
     $tags = array();
     foreach ($post->getTags() as $row) {
         $tag = new stdClass();
         $tag->id = (int) $row->id;
         $tag->title = $row->title;
         $tags[] = $tag;
     }
     // Render default post templates
     $postTemplatesModel = EB::model('Templates');
     $postTemplates = $postTemplatesModel->getPostTemplates($this->my->id);
     // Get the post's author
     $author = $post->getAuthor();
     // Get a list of revisions for this post
     $revisions = $post->getRevisions();
     // Get the current revision for the post
     $workingRevision = $post->getWorkingRevision();
     // Determines if the current page load should be loading from block templates
     $postTemplate = EB::table('PostTemplate');
     $postTemplate->load($this->input->get('block_template', 0, 'int'));
     if (!$postTemplate->id || $postTemplate->id == 1) {
         $postTemplate = false;
     }
     // Get available blocks on the site
     $blocks = EB::blocks()->getAvailableBlocks();
     // Determines if we should display the custom fields tab by default
     $displayFieldsTab = false;
     // Get a list of selected categories
     $selectedCategories = $post->getCategories();
     // If there's no selected categories, we assume that the primary category
     if (!$selectedCategories) {
         $selectedCategories = array($primaryCategory);
     }
     // If explicitly configured to be hidden, skip the checks altogether
     if ($this->config->get('layout_composer_fields')) {
         foreach ($selectedCategories as $category) {
             if ($category->hasCustomFields()) {
                 $displayFieldsTab = true;
                 break;
             }
         }
     }
     $user = EB::table('Profile');
     $user = $user->load($this->my->id);
     //available languages
     $languages = JLanguageHelper::getLanguages('lang_code');
     //post association
     $associations = $post->getAssociation();
     $theme = EB::template();
     $theme->set('user', $user);
     $theme->set('displayFieldsTab', $displayFieldsTab);
     $theme->set('postTemplate', $postTemplate);
     $theme->set('postTemplates', $postTemplates);
     $theme->set('workingRevision', $workingRevision);
     $theme->set('revisions', $revisions);
     $theme->set('editor', $editor);
     $theme->set('primaryCategory', $primaryCategory);
     $theme->set('categories', $categories);
     $theme->set('tags', $tags);
     $theme->set('post', $post);
     $theme->set('author', $author);
     $theme->set('uuid', uniqid());
     $theme->set('blocks', $blocks);
     $theme->set('languages', $languages);
     $theme->set('associations', $associations);
     // Determines if the source id and source type is provided
     $sourceId = $this->input->get('source_id', 0, 'int');
     $sourceType = $this->input->get('source_type', '', 'default');
     $contribution = '';
     if ($sourceId && $sourceType) {
         $contribution = EB::contributor()->load($sourceId, $sourceType);
         $post->source_id = $sourceId;
         $post->source_type = $sourceType;
     }
     $theme->set('contribution', $contribution);
     $theme->set('sourceId', $sourceId);
     $theme->set('sourceType', $sourceType);
     $output = $theme->output('site/composer/manager');
     return $output;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:composer.php

示例8: getPostCount

 /**
  * Retrieves the total number of posts available in a team
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getPostCount($id)
 {
     $db = EB::db();
     $query = array();
     $options = array('teamId' => $id, 'concateOperator' => 'AND');
     // contribution type sql
     $contributor = EB::contributor();
     $contributeSQL = '';
     $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_TEAM, 'a', $options);
     $query[] = 'SELECT COUNT(1) FROM ' . $db->quoteName('#__easyblog_post') . ' AS a';
     $query[] = 'where a.' . $db->quoteName('published') . '=' . $db->Quote(EASYBLOG_POST_PUBLISHED);
     $query[] = 'and a.' . $db->quoteName('state') . '=' . $db->Quote(EASYBLOG_POST_NORMAL);
     $query[] = $contributeSQL;
     // category access here
     $catLib = EB::category();
     $catAccessSQL = $catLib->genAccessSQL('a.`id`');
     $query[] = 'AND (' . $catAccessSQL . ')';
     $query = implode(' ', $query);
     $db->setQuery($query);
     $total = $db->loadResult();
     return $total;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:30,代码来源:teamblogs.php

示例9: _buildQuery

 public function _buildQuery()
 {
     $db = EB::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) . ')';
     $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;
     $query = '';
     // contribution type sql
     $contributor = EB::contributor();
     $contributeSQL = ' AND ( (a.`source_type` = ' . $db->Quote(EASYBLOG_POST_SOURCE_SITEWIDE) . ') ';
     if ($config->get('main_includeteamblogpost')) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_TEAM, 'a');
     }
     if ($includeJSEvent) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_EVENT, 'a');
     }
     if ($includeJSGrp) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_GROUP, 'a');
     }
     if (EB::easysocial()->exists()) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_GROUP, 'a');
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_EVENT, 'a');
     }
     $contributeSQL .= ')';
     $queryWhere .= $contributeSQL;
     // category access here
     $catLib = EB::category();
     $catAccessSQL = $catLib->genAccessSQL('a.`id`');
     $queryWhere .= ' AND (' . $catAccessSQL . ')';
     if ($isBloggerMode) {
         $queryWhere .= ' AND a.`created_by`=' . $db->Quote($isBloggerMode);
     }
     $query = 'SELECT a.*, CONCAT(a.`content` , a.`intro`) AS text';
     $query .= ' FROM `#__easyblog_post` as a USE INDEX (`easyblog_post_searchnew`)';
     // Always inner join with jos_users and a.created_by so that only valid blogs are loaded
     $query .= ' INNER JOIN ' . $db->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 .= ') )';
     //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($my->id);
             // Insert query here.
             $privateBlog .= ' AND (';
             $privateBlog .= ' (a.`access`= 0 ) OR';
             $privateBlog .= ' ( (a.`access` = 20) AND (' . $db->Quote($my->id) . ' > 0 ) ) OR';
             if (empty($friends)) {
                 $privateBlog .= ' ( (a.`access` = 30) AND ( 1 = 2 ) ) OR';
             } else {
                 $privateBlog .= ' ( (a.`access` = 30) AND ( a.' . $db->nameQuote('created_by') . ' IN (' . implode(',', $friends) . ') ) ) OR';
             }
             $privateBlog .= ' ( (a.`access` = 40) AND ( a.' . $db->nameQuote('created_by') . '=' . $my->id . ') )';
             $privateBlog .= ' )';
         } else {
             if ($my->id == 0) {
                 $privateBlog .= ' AND a.`access` = ' . $db->Quote(0);
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:search.php

示例10: getBlogContribution

 /**
  * Retrieves the blog contribution
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getBlogContribution()
 {
     if (!$this->source_type || $this->source_type == EASYBLOG_POST_SOURCE_SITEWIDE) {
         return false;
     }
     $contributor = EB::contributor()->load($this->source_id, $this->source_type);
     return $contributor;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:16,代码来源:post.php

示例11: getTeamBlogCount

 public function getTeamBlogCount($tagId)
 {
     $db = EB::db();
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     $isBloggerMode = EasyBlogRouter::isBloggerMode();
     $extraQuery = '';
     $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 .= ' where b.`tag_id` = ' . $db->Quote($tagId);
     $query .= '  and (a.`source_type` = ' . $db->Quote(EASYBLOG_POST_SOURCE_TEAM);
     // contribution type sql
     $contributor = EB::contributor();
     $contributeSQL = '';
     if ($config->get('main_includeteamblogpost')) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_TEAM, 'a', array('concateOperator' => 'AND'));
     }
     $contributeSQL .= ')';
     $query .= $contributeSQL;
     if ($isBloggerMode !== false) {
         $query .= '  and a.`created_by` = ' . $db->Quote($isBloggerMode);
     }
     $db->setQuery($query);
     $result = $db->loadResult();
     return empty($result) ? '0' : $result;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:27,代码来源:tags.php


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