本文整理汇总了PHP中EasyBlogRouter::isBloggerMode方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogRouter::isBloggerMode方法的具体用法?PHP EasyBlogRouter::isBloggerMode怎么用?PHP EasyBlogRouter::isBloggerMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyBlogRouter
的用法示例。
在下文中一共展示了EasyBlogRouter::isBloggerMode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Class Constructor
*
* @since 3.7
* @access public
*/
public function __construct($sel_theme = null)
{
$config = EasyBlogHelper::getConfig();
$this->user_theme = $config->get('layout_theme');
// Default theme
$theme = 'default';
if (empty($sel_theme)) {
$theme = $config->get('layout_theme');
} elseif ($sel_theme == 'dashboard') {
$theme = $config->get('layout_dashboard_theme');
$this->dashboard = true;
}
$this->_theme = $theme;
$obj = new stdClass();
$obj->config = EasyBlogHelper::getConfig();
$obj->my = JFactory::getUser();
$obj->admin = EasyBlogHelper::isSiteAdmin();
$profile = EasyBlogHelper::getTable('Profile', 'Table');
$profile->load($obj->my->id);
$profile->setUser($obj->my);
$obj->profile = $profile;
$currentTheme = $this->_theme;
if (JRequest::getVar('theme', '') != '') {
$currentTheme = JRequest::getVar('theme');
}
// Legacy fix
if ($currentTheme == 'hako - new') {
$currentTheme = 'default';
}
// @rule: Set the necessary parameters here.
$rawParams = EBLOG_THEMES . DIRECTORY_SEPARATOR . $currentTheme . DIRECTORY_SEPARATOR . 'config.xml';
if (JFile::exists($rawParams) && !$this->dashboard) {
$this->params = EasyBlogHelper::getRegistry();
// @task: Now we bind the default params
$defaultParams = EBLOG_THEMES . DIRECTORY_SEPARATOR . $currentTheme . DIRECTORY_SEPARATOR . 'config.ini';
if (JFile::exists($defaultParams)) {
$this->params->load(JFile::read($defaultParams));
}
$themeConfig = $this->_getThemeConfig($currentTheme);
// @task: Now we override it with the user saved params
if (!empty($themeConfig->params)) {
$extendObj = EasyBlogHelper::getRegistry($themeConfig->params);
EasyBlogRegistryHelper::extend($this->params, $extendObj);
}
}
//is blogger mode flag
$obj->isBloggerMode = EasyBlogRouter::isBloggerMode();
$this->set('system', $obj);
$this->acl = EasyBlogACLHelper::getRuleSet();
}
示例2: getTeamBlogCount
function getTeamBlogCount($catId)
{
$db = EasyBlogHelper::db();
$isBloggerMode = EasyBlogRouter::isBloggerMode();
$query = 'select count(1) from `#__easyblog_post` as a';
$query .= ' inner join `#__easyblog_category` as b';
$query .= ' on a.`category_id` = b.`id`';
$query .= ' and b.`id` = ' . $db->Quote($catId);
$query .= ' inner join `#__easyblog_team_post` as c';
$query .= ' on a.`id` = c.`post_id`';
$query .= ' where a.`issitewide` = ' . $db->Quote('0');
if ($isBloggerMode !== false) {
$query .= ' and a.`created_by` = ' . $db->Quote($isBloggerMode);
}
$db->setQuery($query);
$result = $db->loadResult();
return empty($result) ? '0' : $result;
}
示例3: 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);
//.........这里部分代码省略.........
示例4: getBloggerTheme
public static function getBloggerTheme()
{
$id = EasyBlogRouter::isBloggerMode();
if (empty($id)) {
return false;
}
$profile = EB::user($id);
$userparams = EB::registry($profile->params);
return $userparams->get('theme', false);
}
示例5: _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;
}
示例6: getArchive
public function getArchive($archiveYear, $archiveMonth, $archiveDay = '')
{
$db = EB::db();
$my = JFactory::getUser();
$config = EB::config();
$isBloggerMode = EasyBlogRouter::isBloggerMode();
$excludeCats = array();
$teamBlogIds = '';
$queryExclude = '';
$queryInclude = '';
$catAccess = array();
$modCid = JRequest::getVar('modCid', array());
//where
$queryWhere = ' WHERE a.`published` = ' . $db->Quote(EASYBLOG_POST_PUBLISHED);
$queryWhere = ' AND a.`state` = ' . $db->Quote(EASYBLOG_POST_NORMAL);
$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;
// 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');
}
$contributeSQL .= ')';
$queryWhere .= $contributeSQL;
//get teamblogs id.
$query = '';
if (!empty($modCid)) {
$catAccess['include'] = $modCid;
}
//do not list out protected blog in rss
if (JRequest::getCmd('format', '') == 'feed') {
if ($config->get('main_password_protect', true)) {
$queryWhere .= ' AND a.`blogpassword`="" ';
}
}
//blog privacy setting
// @integrations: jomsocial privacy
$file = JPATH_ROOT . '/components/com_community/libraries/core.php';
$easysocial = EasyBlogHelper::getHelper('EasySocial');
if ($config->get('integrations_easysocial_privacy') && $easysocial->exists() && !EB::isSiteAdmin()) {
$esPrivacyQuery = $easysocial->buildPrivacyQuery('a');
$queryWhere .= $esPrivacyQuery;
} else {
if ($config->get('main_jomsocial_privacy') && JFile::exists($file) && !EB::isSiteAdmin()) {
require_once $file;
$my = JFactory::getUser();
$jsFriends = CFactory::getModel('Friends');
$friends = $jsFriends->getFriendIds($my->id);
// Insert query here.
$queryWhere .= ' AND (';
$queryWhere .= ' (a.`access`= 0 ) OR';
$queryWhere .= ' ( (a.`access` = 20) AND (' . $db->Quote($my->id) . ' > 0 ) ) OR';
if (empty($friends)) {
$queryWhere .= ' ( (a.`access` = 30) AND ( 1 = 2 ) ) OR';
} else {
$queryWhere .= ' ( (a.`access` = 30) AND ( a.' . $db->nameQuote('created_by') . ' IN (' . implode(',', $friends) . ') ) ) OR';
}
$queryWhere .= ' ( (a.`access` = 40) AND ( a.' . $db->nameQuote('created_by') . '=' . $my->id . ') )';
$queryWhere .= ' )';
} else {
if ($my->id == 0) {
$queryWhere .= ' AND a.`access` = ' . $db->Quote(BLOG_PRIVACY_PUBLIC);
}
}
}
if (empty($archiveDay)) {
$fromDate = $archiveYear . '-' . $archiveMonth . '-01 00:00:00';
$toDate = $archiveYear . '-' . $archiveMonth . '-31 23:59:59';
} else {
$fromDate = $archiveYear . '-' . $archiveMonth . '-' . $archiveDay . ' 00:00:00';
$toDate = $archiveYear . '-' . $archiveMonth . '-' . $archiveDay . ' 23:59:59';
}
// When language filter is enabled, we need to detect the appropriate contents
$filterLanguage = JFactory::getApplication()->getLanguageFilter();
if ($filterLanguage) {
$queryWhere .= EBR::getLanguageQuery('AND', 'a.language');
}
$tzoffset = EB::date()->getOffSet(true);
$queryWhere .= ' AND ( DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) >= ' . $db->Quote($fromDate) . ' AND DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) <= ' . $db->Quote($toDate) . ' ) ';
if ($isBloggerMode !== false) {
$queryWhere .= ' AND a.`created_by` = ' . $db->Quote($isBloggerMode);
}
// category access here
//category access
$catLib = EB::category();
//.........这里部分代码省略.........
示例7: 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);
//.........这里部分代码省略.........
示例8: 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;
}
示例9: getBloggerTheme
public static function getBloggerTheme()
{
$id = EasyBlogRouter::isBloggerMode();
if (empty($id)) {
return false;
}
$profile = EasyBlogHelper::getTable('Profile', 'Table');
$profile->load($id);
$userparams = EasyBlogHelper::getRegistry($profile->params);
return $userparams->get('theme', false);
}
示例10: 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;
}
示例11: 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) {
//.........这里部分代码省略.........
示例12: _
public static function _($url, $xhtml = true, $ssl = null, $search = false, $isCanonical = false)
{
$mainframe = JFactory::getApplication();
$config = EasyBlogHelper::getConfig();
static $loaded = array();
static $eUri = array();
$useXHTML = (int) $xhtml . (int) $isCanonical;
if (isset($loaded[$url . $useXHTML])) {
return $loaded[$url . $useXHTML];
}
$rawURL = $url;
$blogger = JRequest::getVar('blogger', '');
if (!empty($blogger)) {
$url .= '&blogger=' . $blogger;
}
//$jURL = JRoute::_($url, false);
$jURL = $url;
// convert the string to variable so that we can access it.
parse_str($jURL, $post);
$view = isset($post['view']) ? $post['view'] : 'latest';
$Itemid = isset($post['Itemid']) ? $post['Itemid'] : '';
$routingBehavior = $config->get('main_routing', 'currentactive');
$exItemid = '';
$findItemId = false;
$dropSegment = false;
if (($routingBehavior == 'currentactive' || $routingBehavior == 'menuitemid') && !$isCanonical) {
$routingMenuItem = $config->get('main_routing_itemid', '');
if ($routingBehavior == 'menuitemid' && $routingMenuItem != '') {
$exItemid = $routingMenuItem;
}
// @rule: If there is already an item id, try to use the explicitly set one.
if (empty($exItemid)) {
if ($view == 'entry') {
$blogId = $post['id'];
$blog = EasyBlogHelper::getTable('Blog', 'Table');
$blog->load($blogId);
$author = $blog->created_by;
if (!empty($author)) {
$tmpItemid = EasyBlogRouter::getItemIdByBlogger($author);
if (!empty($tmpItemid)) {
$isBloggerMode = EasyBlogRouter::isMenuABloggerMode($tmpItemid);
if ($isBloggerMode) {
$exItemid = $tmpItemid;
}
}
}
}
// @rule: If it is not a blogger mode, we just use the current one.
if (!$mainframe->isAdmin()) {
// Retrieve the active menu item.
$menu = JFactory::getApplication()->getMenu();
$item = $menu->getActive();
if (isset($item->id)) {
$isBloggerMode = EasyBlogRouter::isMenuABloggerMode($item->id);
if (!$isBloggerMode) {
$exItemid = $item->id;
}
}
}
}
} else {
switch ($view) {
case 'entry':
$routingOrder = EasyBlogRouter::getDefaultRoutingOrder();
$exItemid = '';
if (!empty($routingOrder)) {
$blogId = $post['id'];
$blog = EasyBlogHelper::getTable('Blog', 'Table');
$blog->load($blogId);
$authorId = $blog->created_by;
$categoryId = $blog->category_id;
foreach ($routingOrder as $key => $val) {
switch ($key) {
case 'bloggerstandalone':
$bloggerId = EasyBlogRouter::isBloggerMode();
if ($bloggerId !== false) {
$exItemid = EasyBlogRouter::getItemIdByBlogger($bloggerId);
}
break;
case 'entry':
$exItemid = EasyBlogRouter::getItemIdByEntry($blogId);
break;
case 'category':
$exItemid = EasyBlogRouter::getItemIdByCategories($categoryId);
break;
case 'blogger':
$exItemid = EasyBlogRouter::getItemIdByBlogger($authorId);
break;
case 'teamblog':
$teamId = $blog->getTeamContributed();
if (!empty($teamId)) {
$exItemid = EasyBlogRouter::getItemIdByTeamBlog($teamId);
}
break;
}
if (!empty($exItemid)) {
break;
}
}
}
//.........这里部分代码省略.........
示例13: _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);
//.........这里部分代码省略.........
示例14: defined
<?php
/**
* @package EasyBlog
* @copyright Copyright (C) 2010 Stack Ideas Private Limited. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* EasyBlog is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined('_JEXEC') or die('Restricted access');
$acl = EasyBlogACLHelper::getRuleSet();
$isBloggerMode = EasyBlogRouter::isBloggerMode();
$itemid = JRequest::getVar('Itemid', '');
$menu = JFactory::getApplication()->getMenu();
$item = $menu->getItem($itemid);
$params = EasyBlogHelper::getRegistry();
if ($item) {
$params->load($item->params);
}
if ($system->config->get('layout_responsive')) {
?>
<script type="text/javascript">
EasyBlog.require()
.script('layout/responsive')
.done(function($){
$('#ezblog-head #ezblog-search').bind('focus', function(){
$(this).animate({ width: '170'} );
示例15: getTagPrivateBlogCount
/**
* *********************************************************************
* These part of codes will used in tag clod tags.
* *********************************************************************
*/
public function getTagPrivateBlogCount($tagId)
{
$db = EB::db();
$isBloggerMode = EasyBlogRouter::isBloggerMode();
$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.`access` = ' . $db->Quote(BLOG_PRIVACY_PRIVATE);
if ($isBloggerMode !== false) {
$query .= ' and a.`created_by` = ' . $db->Quote($isBloggerMode);
}
// category access here
$catLib = EB::category();
$catAccessSQL = $catLib->genAccessSQL('a.`id`');
$query .= ' AND (' . $catAccessSQL . ')';
$db->setQuery($query);
$result = $db->loadResult();
return empty($result) ? '0' : $result;
}