本文整理汇总了PHP中EasyBlogHelper::isSiteAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogHelper::isSiteAdmin方法的具体用法?PHP EasyBlogHelper::isSiteAdmin怎么用?PHP EasyBlogHelper::isSiteAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyBlogHelper
的用法示例。
在下文中一共展示了EasyBlogHelper::isSiteAdmin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public function store($log = true)
{
// @rule: Load language file from the front end.
JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
$config = EasyBlogHelper::getConfig();
$under_approval = false;
if (isset($this->under_approval)) {
$under_approval = true;
// now we need to reset this variable from the blog object.
unset($this->under_approval);
}
// @trigger: onBeforeSave
$this->triggerBeforeSave();
// @rule: Determine if this record is new or not.
if (empty($this->isnew)) {
$isNew = empty($this->id) ? true : false;
} else {
$isNew = true;
}
// @rule: Get the rulesets for this user.
$acl = EasyBlogACLHelper::getRuleSet();
// @rule: Process badword filters for title here.
$blockedWord = EasyBlogHelper::getHelper('String')->hasBlockedWords($this->title);
if ($blockedWord !== false) {
$this->setError(JText::sprintf('COM_EASYBLOG_BLOG_TITLE_CONTAIN_BLOCKED_WORDS', $blockedWord));
return false;
}
// @rule: Check for minimum words in the content if required.
if ($config->get('main_post_min')) {
$minimum = $config->get('main_post_length');
$total = JString::strlen(strip_tags($this->intro . $this->content));
if ($total < $minimum) {
$this->setError(JText::sprintf('COM_EASYBLOG_CONTENT_LESS_THAN_MIN_LENGTH', $minimum));
return false;
}
}
// @rule: Check for invalid title
if (empty($this->title) || $this->title == JText::_('COM_EASYBLOG_DASHBOARD_WRITE_DEFAULT_TITLE')) {
$this->setError(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_EMPTY_TITLE_ERROR'));
return false;
}
// @rule: For edited blogs, ensure that they have permissions to edit it.
if (!$isNew && $this->created_by != JFactory::getUser()->id && !EasyBlogHelper::isSiteAdmin() && empty($acl->rules->moderate_entry)) {
if (!class_exists('EasyBlogModelTeamBlogs')) {
jimport('joomla.application.component.model');
JLoader::import('blog', EBLOG_ROOT . DIRECTORY_SEPARATOR . 'models');
}
// @task: Only throw error when this blog post is not a team blog post and it's not owned by the current logged in user.
JModel::addIncludePath(JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'models');
$model = JModel::getInstance('TeamBlogs', 'EasyBlogModel');
$contribution = $model->getBlogContributed($this->id);
if (!$contribution || !$model->checkIsTeamAdmin(JFactory::getUser()->id, $contribution->team_id)) {
$this->setError(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_EDIT_BLOG'));
return false;
}
}
// @rule: Every blog post must be assigned to a category
if (empty($this->category_id)) {
$this->setError(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_EMPTY_CATEGORY_ERROR'));
return false;
}
// Filter / strip contents that are not allowed
$filterTags = EasyBlogHelper::getHelper('Acl')->getFilterTags();
$filterAttributes = EasyBlogHelper::getHelper('Acl')->getFilterAttributes();
// @rule: Apply filtering on contents
jimport('joomla.filter.filterinput');
$inputFilter = JFilterInput::getInstance($filterTags, $filterAttributes, 1, 1, 0);
$inputFilter->tagBlacklist = $filterTags;
$inputFilter->attrBlacklist = $filterAttributes;
if (count($filterTags) > 0 && !empty($filterTags[0]) || count($filterAttributes) > 0 && !empty($filterAttributes[0])) {
$this->intro = $inputFilter->clean($this->intro);
$this->content = $inputFilter->clean($this->content);
}
// @rule: Process badword filters for content here.
$blockedWord = EasyBlogHelper::getHelper('String')->hasBlockedWords($this->intro . $this->content);
if ($blockedWord !== false) {
$this->setError(JText::sprintf('COM_EASYBLOG_BLOG_POST_CONTAIN_BLOCKED_WORDS', $blockedWord));
return false;
}
// @rule: Test for the empty-ness
if (empty($this->intro) && empty($this->content)) {
$this->setError(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_CONTENT_ERROR'));
}
// alway set this to false no matter what! TODO: remove this column.
$this->ispending = '0';
$state = parent::store();
$source = JRequest::getVar('blog_contribute_source', 'easyblog');
// @trigger: onBeforeSave
$this->triggerAfterSave();
// if this is blog edit, then we should see the column isnew to determine
// whether the post is really new or not.
if (!$isNew) {
$isNew = $this->isnew;
}
// @task: If auto featured is enabled, we need to feature the blog post automatically since the blogger is featured.
if ($config->get('main_autofeatured', 0) && EasyBlogHelper::isFeatured('blogger', $this->created_by) && !EasyBlogHelper::isFeatured('post', $this->id)) {
EasyBlogHelper::makeFeatured('post', $this->id);
}
// @task: This is when the blog is either created or updated.
if ($source == 'easyblog' && $state && $this->published == POST_ID_PUBLISHED && $log) {
//.........这里部分代码省略.........
示例2: jomsocialForm
private function jomsocialForm($external, $groupId = '0', $blogSource = '', $isPending = 0)
{
$my = JFactory::getUser();
$file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
//extra checking incase somewhere still passing empty blogSource.
$blogSource = empty($blogSource) ? 'group' : $blogSource;
if (!JFile::exists($file)) {
return false;
}
require_once $file;
$model = CFactory::getModel('groups');
if (EasyBlogHelper::isSiteAdmin() && $isPending) {
$rows = $model->getAllGroups();
} else {
$rows = $model->getGroups($my->id, null, false);
}
$groups = array();
JTable::addIncludePath(JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'tables');
foreach ($rows as $row) {
$group = JTable::getInstance('Group', 'CTable');
$group->load($row->id);
$data = new stdClass();
$data->id = $group->id;
$data->title = $group->name;
$data->avatar = $group->getAvatar();
$groups[] = $data;
}
$theme = EB::template();
$theme->set('blogSource', $blogSource);
$theme->set('external', $external);
$theme->set('groups', $groups);
$theme->set('groupId', $groupId);
return $theme->output('site/jomsocial/groups');
}
示例3: removeFeatured
/**
* Remove an item as featured
*
* @param string $type The type of this item
* @param int $postId The unique id of the item
*
* @return string Json string
**/
function removeFeatured($type, $postId)
{
$ajax = new Ejax();
$acl = EasyBlogACLHelper::getRuleset();
// Only super admins can feature items
if (!EasyBlogHelper::isSiteAdmin() && !$acl->rules->feature_entry) {
$ajax->alert(JText::_('COM_EASYBLOG_NOT_ALLOWED'), '', '450');
$ajax->send();
return;
}
EasyBlogHelper::removeFeatured($type, $postId);
$idName = '';
$message = '';
switch ($type) {
case 'blogger':
$idName = '#blogger_title_' . $postId;
$message = JText::_('COM_EASYBLOG_BLOGGER_UNFEATURED');
break;
case 'teamblog':
$idName = '#teamblog_title_' . $postId;
$message = JText::_('COM_EASYBLOG_TEAMBLOG_UNFEATURED');
break;
case 'post':
default:
$idName = '#title_' . $postId;
$message = JText::_('COM_EASYBLOG_BLOG_UNFEATURED');
break;
}
$ajax->script('$("' . $idName . '").removeClass("featured-item");');
$ajax->alert($message, JText::_('COM_EASYBLOG_INFO'), '450', 'auto');
$ajax->send();
return;
}
示例4: display
/**
* Displays the files and folders that are in the media manager.
*/
public function display($tpl = null)
{
$config = EasyBlogHelper::getConfig();
$document = JFactory::getDocument();
$my = JFactory::getUser();
$app = JFactory::getApplication();
$profile = EasyBlogHelper::getTable('Profile');
$profile->load($my->id);
if ($my->id <= 0) {
echo JText::_('COM_EASYBLOG_NOT_ALLOWED');
exit;
}
$user = JFactory::getUser();
$document->setTitle(JText::_('COM_EASYBLOG_MEDIA_MANAGER'));
// Only allow admin to impersonate anyone.
if (EasyBlogHelper::isSiteAdmin()) {
$user = JFactory::getUser(JRequest::getVar('blogger_id', $my->id));
}
$debug = $config->get('debug_javascript') || JRequest::getVar('ebjsdebug') == 1 ? 'true' : 'false';
$theme = new CodeThemes(true);
$theme->set('debug', $debug);
$theme->set('session', JFactory::getSession());
$theme->set('blogger_id', $user->id);
// @rule: Test if the user is already associated with Flickr
$oauth = EasyBlogHelper::getTable('Oauth');
$associated = $oauth->loadByUser($my->id, EBLOG_OAUTH_FLICKR);
$theme->set('flickrAssociated', $associated);
echo $theme->fetch('media.php');
}
示例5: __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();
}
示例6: updateComment
public function updateComment()
{
$mainframe = JFactory::getApplication();
$my = JFactory::getUser();
$acl = EB::acl();
$id = JRequest::getInt('commentId');
$post = JRequest::get('POST');
//add here so that other component with the same comment.php jtable file will not get reference.
JTable::addIncludePath(EBLOG_TABLES);
$comment = EB::table('Comment');
$comment->load($id);
$redirect = EBR::_('index.php?option=com_easyblog&view=entry&id=' . $comment->post_id, false);
if (($my->id != $comment->created_by || !$acl->get('delete_comment')) && !EasyBlogHelper::isSiteAdmin() && !$acl->get('manage_comment') || $my->id == 0) {
EB::info()->set(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_UPDATE_COMMENT'), 'error');
$mainframe->redirect($redirect);
$mainframe->close();
}
$comment->bindPost($post);
if (!$comment->validate('title')) {
EB::info()->set(JText::_('COM_EASYBLOG_COMMENT_TITLE_IS_EMPTY'), 'error');
$mainframe->redirect($redirect);
$mainframe->close();
}
if (!$comment->validate('comment')) {
EB::info()->set(JText::_('COM_EASYBLOG_COMMENT_IS_EMPTY'), 'error');
$mainframe->redirect($redirect);
$mainframe->close();
}
$comment->modified = EB::date()->toMySQL();
if (!$comment->store()) {
EB::info()->set(JText::_('COM_EASYBLOG_COMMENT_FAILED_TO_SAVE'), 'error');
$mainframe->redirect($redirect);
$mainframe->close();
}
EB::info()->set(JText::_('COM_EASYBLOG_COMMENT_UPDATED_SUCCESS'), 'success');
$mainframe->redirect($redirect);
$mainframe->close();
}
示例7: getTotalRequest
function getTotalRequest()
{
$my = JFactory::getUser();
$userId = EasyBlogHelper::isSiteAdmin() ? '' : $my->id;
return count($this->getTeamBlogRequest($userId, false));
}
示例8: deleteComment
public function deleteComment($id)
{
$config = EasyBlogHelper::getConfig();
$my = JFactory::getUser();
$ajax = new Ejax();
$acl = EasyBlogACLHelper::getRuleSet();
JTable::addIncludePath(EBLOG_TABLES);
$comment = EasyBlogHelper::getTable('Comment', 'Table');
$comment->load($id);
if (($my->id == 0 || $my->id != $comment->created_by || !$acl->rules->delete_comment) && !EasyBlogHelper::isSiteAdmin()) {
$ajax->alert(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_EDIT_COMMENT'), JText::_('COM_EASYBLOG_INFO'), '450', 'auto');
return $ajax->send();
}
$tpl = new CodeThemes();
$tpl->set('comment', $comment);
$options = new stdClass();
$options->title = JText::_('COM_EASYBLOG_DASHBOARD_DELETE_COMMENT');
$options->content = $tpl->fetch('ajax.dialog.comments.delete.php');
$ajax->dialog($options);
$ajax->send();
}
示例9: 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') {
//.........这里部分代码省略.........
示例10: statistic
function statistic()
{
JPluginHelper::importPlugin('easyblog');
$dispatcher = JDispatcher::getInstance();
$mainframe = JFactory::getApplication();
$document = JFactory::getDocument();
$config = EasyBlogHelper::getConfig();
$my = JFactory::getUser();
$acl = EasyBlogACLHelper::getRuleSet();
$sort = JRequest::getCmd('sort', 'latest');
$id = JRequest::getInt('id', 0);
//setting pathway
$pathway = $mainframe->getPathway();
$this->setPathway(JText::_('COM_EASYBLOG_TEAMBLOG'), EasyBlogRouter::_('index.php?option=com_easyblog&view=teamblog'));
$id = JRequest::getInt('id', 0);
if ($id == 0) {
echo JText::_('COM_EASYBLOG_TEAMBLOG_INVALID_ID');
return;
}
// set meta tags for teamblog view
EasyBlogHelper::setMeta($id, META_TYPE_TEAM);
//stats type
$statType = JRequest::getString('stat', '');
$statId = $statType == 'tag' ? JRequest::getString('tagid', '') : JRequest::getString('catid', '');
$statObject = null;
if ($statType == 'category') {
$statObject = EasyBlogHelper::getTable('Category', 'Table');
$statObject->load($statId);
} else {
$statObject = EasyBlogHelper::getTable('Tag', 'Table');
$statObject->load($statId);
}
$team = EasyBlogHelper::getTable('TeamBlog', 'Table');
$team->load($id);
$team->avatar = $team->getAvatar();
$gid = EasyBlogHelper::getUserGids();
$isMember = $team->isMember($my->id, $gid);
//check if the logged in user a teammember when the team set to member only.
if ($team->access == EBLOG_TEAMBLOG_ACCESS_MEMBER) {
$isMember = $team->isMember($my->id, $gid);
}
$team->isMember = $isMember;
// check if team description is emtpy or not. if yes, show default message.
if (empty($team->description)) {
$team->description = JText::_('COM_EASYBLOG_TEAMBLOG_NO_DESCRIPTION');
}
//add the pathway for teamblog
$this->setPathway($team->title, '');
$tbModel = $this->getModel('TeamBlogs');
$model = $this->getModel('Blog');
$blogs = $model->getBlogsBy('teamblog', $team->id);
$blogs = EasyBlogHelper::formatBlog($blogs);
$pagination = $model->getPagination();
//now get the teams info
$members = $tbModel->getTeamMembers($team->id);
$teamMembers = EasyBlogHelper::formatTeamMembers($members);
$isFeatured = EasyBlogHelper::isFeatured('teamblog', $team->id);
$pageTitle = EasyBlogHelper::getPageTitle($config->get('main_title'));
$pageNumber = $pagination->get('pages.current');
$pageText = $pageNumber == 1 ? '' : ' - ' . JText::sprintf('COM_EASYBLOG_PAGE_NUMBER', $pageNumber);
$document->setTitle($team->title . $pageText . $pageTitle);
EasyBlogHelper::storeSession($team->id, 'EASYBLOG_TEAMBLOG_ID');
//var_dump($blogs);exit;
$tpl = new CodeThemes();
$tpl->set('team', $team);
$tpl->set('teamMembers', $teamMembers);
$tpl->set('data', $blogs);
$tpl->set('isFeatured', $isFeatured);
$tpl->set('pagination', $pagination->getPagesLinks());
$tpl->set('siteadmin', EasyBlogHelper::isSiteAdmin());
$tpl->set('config', $config);
$tpl->set('my', $my);
$tpl->set('acl', $acl);
$tpl->set('statType', $statType);
$tpl->set('statObject', $statObject);
echo $tpl->fetch('blog.teamblogs.php');
}
示例11: isSiteAdmin
public static function isSiteAdmin($user)
{
return EasyBlogHelper::isSiteAdmin($user->id);
}
示例12:
</div>
</div>
</div><!--end: .profile-sidebar-->
<?php
}
// end stat
?>
<?php
if ($this->getParam('show_teamblogstatsitem')) {
?>
<div class="profile-main">
<?php
if ($row->access == EBLOG_TEAMBLOG_ACCESS_MEMBER && !$row->isMember && !EasyBlogHelper::isSiteAdmin()) {
?>
<div class="eblog-message warning mtm">
<?php
echo JText::_('COM_EASYBLOG_TEAMBLOG_MEMBERS_ONLY');
?>
<?php
echo $system->my->id != 0 ? JText::sprintf('COM_EASYBLOG_TEAMBLOG_CLICK_TO_JOIN', 'eblog.teamblog.join(' . $row->id . ')') : '';
?>
</div>
<?php
} else {
?>
<?php
if (empty($row->blogs)) {
?>
示例13: 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) {
//.........这里部分代码省略.........
示例14:
<td class="key">
<label for="url"><?php
echo JText::_('COM_EASYBLOG_BLOGGERS_EDIT_WEBSITE');
?>
</label>
</td>
<td class="paramlist_value">
<input type="text" name="url" id="url" value="<?php
echo $this->escape($this->blogger->url);
?>
" size="40" style="width: 350px;" />
</td>
</tr>
<?php
if (EasyBlogHelper::isSiteAdmin()) {
?>
<tr>
<td class="key">
<label for="url"><?php
echo JText::_('COM_EASYBLOG_BLOGGERS_EDIT_PERMALINK');
?>
</label>
</td>
<td class="paramlist_value">
<input type="text" name="user_permalink" id="user_permalink" value="<?php
echo $this->escape($this->blogger->permalink);
?>
" size="40" style="width: 350px;" />
<div class="small"><?php
echo JText::_('COM_EASYBLOG_BLOGGERS_EDIT_PERMALINK_USAGE');
示例15: calendar
function calendar($tmpl = null)
{
JPluginHelper::importPlugin('easyblog');
$dispatcher = JDispatcher::getInstance();
$mainframe = JFactory::getApplication();
$document = JFactory::getDocument();
$config = EasyBlogHelper::getConfig();
$my = JFactory::getUser();
$acl = EasyBlogACLHelper::getRuleSet();
//setting pathway
$pathway = $mainframe->getPathway();
if (!EasyBlogRouter::isCurrentActiveMenu('archive')) {
$pathway->addItem(JText::_('COM_EASYBLOG_ARCHIVE_BREADCRUMB'), '');
}
EasyBlogHelper::getHelper('Feeds')->addHeaders('index.php?option=com_easyblog&view=archive');
$menuParams = $mainframe->getParams();
$defaultYear = $menuParams->get('es_archieve_year', 0);
$defaultMonth = $menuParams->get('es_archieve_month', 0);
$archiveYear = JRequest::getVar('archiveyear', $defaultYear, 'REQUEST');
$archiveMonth = JRequest::getVar('archivemonth', $defaultMonth, 'REQUEST');
$archiveDay = JRequest::getVar('archiveday', 0, 'REQUEST');
$itemId = JRequest::getInt('Itemid', 0);
if (empty($archiveYear) || empty($archiveMonth)) {
// @task: Set the page title
$title = EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_ARCHIVE_PAGE_TITLE'));
parent::setPageTitle($title, false, $config->get('main_pagetitle_autoappend'));
$tpl = new CodeThemes();
$tpl->set('itemId', $itemId);
echo $tpl->fetch('calendar.php');
return;
}
$date = EasyBlogHelper::getDate();
$sort = 'latest';
$model = $this->getModel('Archive');
$year = $model->getArchiveMinMaxYear();
$data = $model->getArchive($archiveYear, $archiveMonth, $archiveDay);
$pagination = $model->getPagination();
$params = $mainframe->getParams('com_easyblog');
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
$data = EasyBlogHelper::formatBlog($data);
//if day is empty
if (empty($archiveDay)) {
$archiveDay = '01';
$dateformat = '%B %Y';
$emptyPostMsg = JText::_('COM_EASYBLOG_ARCHIVE_NO_ENTRIES_ON_MONTH');
} else {
$dateformat = '%d %B %Y';
$emptyPostMsg = JText::_('COM_EASYBLOG_ARCHIVE_NO_ENTRIES_ON_DAY');
}
$archiveDay = strlen($archiveDay) < 2 ? '0' . $archiveDay : $archiveDay;
$viewDate = EasyBlogHelper::getDate($archiveYear . '-' . $archiveMonth . '-' . $archiveDay);
$formatedDate = $viewDate->toFormat($dateformat);
$archiveTitle = JText::sprintf('COM_EASYBLOG_ARCHIVE_HEADING_TITLE', $formatedDate);
// @task: Set the page title
$title = EasyBlogHelper::getPageTitle(JText::sprintf('COM_EASYBLOG_ARCHIVE_HEADING_TITLE', $formatedDate));
parent::setPageTitle($title, false, $config->get('main_pagetitle_autoappend'));
// set meta tags for featured view
EasyBlogHelper::setMeta(META_ID_ARCHIVE, META_TYPE_VIEW, JText::_('COM_EASYBLOG_ARCHIVE_PAGE_TITLE') . ' - ' . $formatedDate);
// set meta tags for featured view
EasyBlogHelper::setMeta(META_ID_ARCHIVE, META_TYPE_VIEW, JText::_('COM_EASYBLOG_ARCHIVE_PAGE_TITLE') . ' - ' . $formatedDate);
$tpl = new CodeThemes();
$tpl->set('data', $data);
$tpl->set('pagination', $pagination->getPagesLinks());
$tpl->set('siteadmin', EasyBlogHelper::isSiteAdmin());
$tpl->set('archiveYear', $archiveYear);
$tpl->set('archiveMonth', $archiveMonth);
$tpl->set('archiveDay', $archiveDay);
$tpl->set('config', $config);
$tpl->set('my', $my);
$tpl->set('acl', $acl);
$tpl->set('archiveTitle', $archiveTitle);
$tpl->set('emptyPostMsg', $emptyPostMsg);
echo $tpl->fetch('blog.archive.php');
}