本文整理汇总了PHP中KunenaUser::isBanned方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaUser::isBanned方法的具体用法?PHP KunenaUser::isBanned怎么用?PHP KunenaUser::isBanned使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaUser
的用法示例。
在下文中一共展示了KunenaUser::isBanned方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before
protected function before()
{
KUNENA_PROFILER ? KunenaProfiler::instance()->start('function ' . get_class($this) . '::' . __FUNCTION__ . '()') : null;
if (!$this->exists()) {
KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . get_class($this) . '::' . __FUNCTION__ . '()') : null;
throw new RuntimeException("Layout '{$this->input->getWord('view')}/{$this->input->getWord('layout', 'default')}' does not exist!", 404);
}
// Load language files.
KunenaFactory::loadLanguage('com_kunena.sys', 'admin');
KunenaFactory::loadLanguage('com_kunena.templates');
KunenaFactory::loadLanguage('com_kunena.models');
KunenaFactory::loadLanguage('com_kunena.views');
$this->me = KunenaUserHelper::getMyself();
$this->config = KunenaConfig::getInstance();
$this->document = JFactory::getDocument();
$this->template = KunenaFactory::getTemplate();
$this->template->initialize();
if ($this->me->isAdmin()) {
// Display warnings to the administrator if forum is either offline or debug has been turned on.
if ($this->config->board_offline) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_FORUM_IS_OFFLINE'), 'notice');
}
if ($this->config->debug) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_WARNING_DEBUG'), 'notice');
}
}
if ($this->me->isBanned()) {
// Display warnings to the banned users.
$banned = KunenaUserBan::getInstanceByUserid($this->me->userid, true);
if (!$banned->isLifetime()) {
$this->app->enqueueMessage(JText::sprintf('COM_KUNENA_POST_ERROR_USER_BANNED_NOACCESS_EXPIRY', KunenaDate::getInstance($banned->expiration)->toKunena('date_today')), 'notice');
} else {
$this->app->enqueueMessage(JText::_('COM_KUNENA_POST_ERROR_USER_BANNED_NOACCESS'), 'notice');
}
}
// Remove base and add canonical link.
$this->document->setBase('');
$this->document->addHeadLink(KunenaRoute::_(), 'canonical', 'rel', '');
// Initialize breadcrumb.
$this->breadcrumb = $this->app->getPathway();
KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . get_class($this) . '::' . __FUNCTION__ . '()') : null;
}
示例2: authoriseNotBanned
/**
* @param KunenaUser $user
*
* @return KunenaExceptionAuthorise|null
*/
protected function authoriseNotBanned(KunenaUser $user)
{
$banned = $user->isBanned();
if ($banned) {
$banned = KunenaUserBan::getInstanceByUserid($user->userid, true);
if (!$banned->isLifetime()) {
return new KunenaExceptionAuthorise(JText::sprintf('COM_KUNENA_POST_ERROR_USER_BANNED_NOACCESS_EXPIRY', KunenaDate::getInstance($banned->expiration)->toKunena()), 403);
} else {
return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_POST_ERROR_USER_BANNED_NOACCESS'), 403);
}
}
return null;
}
示例3: before
/**
* Prepare category index display.
*
* @return void
*/
protected function before()
{
parent::before();
$this->me = KunenaUserHelper::getMyself();
// Get sections to display.
$catid = $this->input->getInt('catid', 0);
if ($catid) {
$sections = KunenaForumCategoryHelper::getCategories($catid);
} else {
$sections = KunenaForumCategoryHelper::getChildren();
}
$sectionIds = array();
$this->more[$catid] = 0;
foreach ($sections as $key => $category) {
$this->categories[$category->id] = array();
$this->more[$category->id] = 0;
// Display only categories which are supposed to show up.
if ($catid || $category->params->get('display.index.parent', 3) > 0) {
if ($catid || $category->params->get('display.index.children', 3) > 1) {
$sectionIds[] = $category->id;
} else {
$this->more[$category->id]++;
}
} else {
$this->more[$category->parent_id]++;
unset($sections[$key]);
continue;
}
}
// Get categories and subcategories.
if (empty($sections)) {
return;
}
$this->sections = $sections;
$categories = KunenaForumCategoryHelper::getChildren($sectionIds);
if (empty($categories)) {
return;
}
$categoryIds = array();
$topicIds = array();
$userIds = array();
$postIds = array();
foreach ($categories as $key => $category) {
$this->more[$category->id] = 0;
// Display only categories which are supposed to show up.
if ($catid || $category->params->get('display.index.parent', 3) > 1) {
if ($catid || $category->getParent()->params->get('display.index.children', 3) > 2 && $category->params->get('display.index.children', 3) > 2) {
$categoryIds[] = $category->id;
} else {
$this->more[$category->id]++;
}
} else {
$this->more[$category->parent_id]++;
unset($categories[$key]);
continue;
}
// Get list of topics.
$last = $category->getLastCategory();
if ($last->last_topic_id) {
$topicIds[$last->last_topic_id] = $last->last_topic_id;
}
$this->categories[$category->parent_id][] = $category;
$rssURL = $category->getRSSUrl();
if (!empty($rssURL)) {
$category->rssURL = $category->getRSSUrl();
}
}
$subcategories = KunenaForumCategoryHelper::getChildren($categoryIds);
foreach ($subcategories as $category) {
// Display only categories which are supposed to show up.
if ($catid || $category->params->get('display.index.parent', 3) > 2) {
$this->categories[$category->parent_id][] = $category;
} else {
$this->more[$category->parent_id]++;
}
}
// Pre-fetch topics (also display unauthorized topics as they are in allowed categories).
$topics = KunenaForumTopicHelper::getTopics($topicIds, 'none');
// Pre-fetch users (and get last post ids for moderators).
foreach ($topics as $topic) {
$userIds[$topic->last_post_userid] = $topic->last_post_userid;
$postIds[$topic->id] = $topic->last_post_id;
}
KunenaUserHelper::loadUsers($userIds);
KunenaForumMessageHelper::getMessages($postIds);
// Pre-fetch user related stuff.
$this->pending = array();
if ($this->me->exists() && !$this->me->isBanned()) {
// Load new topic counts.
KunenaForumCategoryHelper::getNewTopics(array_keys($categories + $subcategories));
// Get categories which are moderated by current user.
$access = KunenaAccess::getInstance();
$moderate = $access->getAdminStatus($this->me) + $access->getModeratorStatus($this->me);
if (!empty($moderate[0])) {
// Global moderators.
//.........这里部分代码省略.........