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


PHP KunenaUserBan类代码示例

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


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

示例1: before

 /**
  * Prepare ban form.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $userid = $this->input->getInt('userid');
     $this->profile = KunenaUserHelper::get($userid);
     $this->profile->tryAuthorise('ban');
     $this->banInfo = KunenaUserBan::getInstanceByUserid($userid, true);
     $this->headerText = $this->banInfo->exists() ? JText::_('COM_KUNENA_BAN_EDIT') : JText::_('COM_KUNENA_BAN_NEW');
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:16,代码来源:display.php

示例2: displayAll

 public function displayAll()
 {
     if ($this->me->isAdmin()) {
         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()) {
         $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');
         }
     }
     $this->state = $this->get('State');
     $this->ktemplate->initialize();
     if (JFactory::getApplication()->isAdmin()) {
         $this->displayLayout();
     } else {
         $this->document->addHeadLink(KunenaRoute::_(), 'canonical', 'rel', '');
         include JPATH_SITE . '/' . $this->ktemplate->getFile('html/display.php');
         if ($this->config->get('credits', 1)) {
             $this->poweredBy();
         }
     }
 }
开发者ID:proyectoseb,项目名称:University,代码行数:30,代码来源:view.php

示例3: storeInstance

	/**
	 * @param KunenaUserBan $instance
	 */
	private static function storeInstance($instance) {
		// Fill userid cache
		self::cacheUserid($instance->userid);
		self::cacheUserid($instance->created_by);
		self::cacheUserid($instance->modified_by);
		foreach ($instance->comments as $comment) {
			self::cacheUserid($comment->userid);
		}

		if ($instance->id) self::$_instances[$instance->id] = $instance;
		if ($instance->userid && ($instance->isEnabled() || !$instance->id)) {
			self::$_instancesByUserid[$instance->userid] = $instance;
		}
		if ($instance->ip && ($instance->isEnabled() || !$instance->id)) {
			self::$_instancesByIP[$instance->ip] = $instance;
		}
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:20,代码来源:ban.php

示例4: before

 /**
  * Prepare topic moderate display.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $catid = $this->input->getInt('catid');
     $id = $this->input->getInt('id');
     $mesid = $this->input->getInt('mesid');
     if (!$mesid) {
         $this->topic = KunenaForumTopicHelper::get($id);
         $this->topic->tryAuthorise('move');
     } else {
         $this->message = KunenaForumMessageHelper::get($mesid);
         $this->message->tryAuthorise('move');
         $this->topic = $this->message->getTopic();
     }
     $this->category = $this->topic->getCategory();
     $this->uri = "index.php?option=com_kunena&view=topic&layout=moderate" . "&catid={$this->category->id}&id={$this->topic->id}" . ($this->message ? "&mesid={$this->message->id}" : '');
     $this->title = !$this->message ? JText::_('COM_KUNENA_TITLE_MODERATE_TOPIC') : JText::_('COM_KUNENA_TITLE_MODERATE_MESSAGE');
     // Load topic icons if available.
     if ($this->config->topicicons) {
         $this->template = KunenaTemplate::getInstance();
         $this->template->setCategoryIconset();
         $this->topicIcons = $this->template->getTopicIcons(false);
     }
     // Have a link to moderate user as well.
     if (isset($this->message)) {
         $user = $this->message->getAuthor();
         if ($user->exists()) {
             $username = $user->getName();
             $this->userLink = $this->message->userid ? JHtml::_('kunenaforum.link', 'index.php?option=com_kunena&view=user&layout=moderate&userid=' . $this->message->userid, $username . ' (' . $this->message->userid . ')', $username . ' (' . $this->message->userid . ')') : null;
         }
     }
     if ($this->message) {
         $this->banHistory = KunenaUserBan::getUserHistory($this->message->userid);
         $this->me = KunenaFactory::getUser();
         // Get thread and reply count from current message:
         $db = JFactory::getDbo();
         $query = "SELECT COUNT(mm.id) AS replies FROM #__kunena_messages AS m\r\n\t\t\t\tINNER JOIN #__kunena_messages AS t ON m.thread=t.id\r\n\t\t\t\tLEFT JOIN #__kunena_messages AS mm ON mm.thread=m.thread AND mm.time > m.time\r\n\t\t\t\tWHERE m.id={$db->Quote($this->message->id)}";
         $db->setQuery($query, 0, 1);
         $this->replies = $db->loadResult();
         if (KunenaError::checkDatabaseError()) {
             return;
         }
     }
     $this->banInfo = KunenaUserBan::getInstanceByUserid(JFactory::getUser()->id, true);
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:52,代码来源:display.php

示例5: displayAll

 public function displayAll()
 {
     if ($this->inLayout) {
         throw new LogicException(sprintf('HMVC template should not call %s::%s()', __CLASS__, __FUNCTION__));
     }
     if ($this->me->isAdmin()) {
         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()) {
         $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');
         }
     }
     $this->state = $this->get('State');
     $this->ktemplate->initialize();
     $menu = $this->app->getMenu();
     $home = $menu->getItems('type', 'alias');
     $juricurrent = JURI::current();
     if (JFactory::getApplication()->isAdmin()) {
         $this->displayLayout();
     } elseif ($home) {
         $this->document->addHeadLink($juricurrent, 'canonical', 'rel', '');
         include JPATH_SITE . '/' . $this->ktemplate->getFile('html/display.php');
     } else {
         $this->document->addHeadLink(KunenaRoute::_(), 'canonical', 'rel', '');
         include JPATH_SITE . '/' . $this->ktemplate->getFile('html/display.php');
         if ($this->config->get('credits', 1)) {
             $this->poweredBy();
         }
     }
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:39,代码来源:view.php

示例6: ban

 function ban()
 {
     $user = KunenaFactory::getUser(JRequest::getInt('userid', 0));
     if (!$user->exists() || !JSession::checkToken('post')) {
         $this->app->redirect($user->getUrl(false), JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
         return;
     }
     $ban = KunenaUserBan::getInstanceByUserid($user->userid, true);
     if (!$ban->canBan()) {
         $this->setRedirect($user->getUrl(false), $ban->getError(), 'error');
         return;
     }
     $ip = JRequest::getString('ip', '');
     $block = JRequest::getInt('block', 0);
     $expiration = JRequest::getString('expiration', '');
     $reason_private = JRequest::getString('reason_private', '');
     $reason_public = JRequest::getString('reason_public', '');
     $comment = JRequest::getString('comment', '');
     if (!$ban->id) {
         $ban->ban($user->userid, $ip, $block, $expiration, $reason_private, $reason_public, $comment);
         $success = $ban->save();
         $this->report($user->userid);
     } else {
         $delban = JRequest::getString('delban', '');
         if ($delban) {
             $ban->unBan($comment);
             $success = $ban->save();
         } else {
             $ban->blocked = $block;
             $ban->setExpiration($expiration, $comment);
             $ban->setReason($reason_public, $reason_private);
             $success = $ban->save();
         }
     }
     if ($block) {
         if ($ban->isEnabled()) {
             $message = JText::_('COM_KUNENA_USER_BLOCKED_DONE');
         } else {
             $message = JText::_('COM_KUNENA_USER_UNBLOCKED_DONE');
         }
     } else {
         if ($ban->isEnabled()) {
             $message = JText::_('COM_KUNENA_USER_BANNED_DONE');
         } else {
             $message = JText::_('COM_KUNENA_USER_UNBANNED_DONE');
         }
     }
     if (!$success) {
         $this->app->enqueueMessage($ban->getError(), 'error');
     } else {
         $this->app->enqueueMessage($message);
     }
     $banDelPosts = JRequest::getString('bandelposts', '');
     $DelAvatar = JRequest::getString('delavatar', '');
     $DelSignature = JRequest::getString('delsignature', '');
     $DelProfileInfo = JRequest::getString('delprofileinfo', '');
     if (!empty($DelAvatar) || !empty($DelProfileInfo)) {
         jimport('joomla.filesystem.file');
         $avatar_deleted = '';
         // Delete avatar from file system
         if (JFile::exists(JPATH_ROOT . '/media/kunena/avatars/' . $user->avatar) && !stristr($user->avatar, 'gallery/')) {
             JFile::delete(JPATH_ROOT . '/media/kunena/avatars/' . $user->avatar);
             $avatar_deleted = JText::_('COM_KUNENA_MODERATE_DELETED_BAD_AVATAR_FILESYSTEM');
         }
         $user->avatar = '';
         $user->save();
         $this->app->enqueueMessage(JText::_('COM_KUNENA_MODERATE_DELETED_BAD_AVATAR') . $avatar_deleted);
     }
     if (!empty($DelProfileInfo)) {
         $user->personalText = '';
         $user->birthdate = '0000-00-00';
         $user->location = '';
         $user->gender = 0;
         $user->icq = '';
         $user->aim = '';
         $user->yim = '';
         $user->msn = '';
         $user->skype = '';
         $user->gtalk = '';
         $user->twitter = '';
         $user->facebook = '';
         $user->myspace = '';
         $user->linkedin = '';
         $user->delicious = '';
         $user->friendfeed = '';
         $user->digg = '';
         $user->blogspot = '';
         $user->flickr = '';
         $user->bebo = '';
         $user->websitename = '';
         $user->websiteurl = '';
         $user->signature = '';
         $user->save();
         $this->app->enqueueMessage(JText::_('COM_KUNENA_MODERATE_DELETED_BAD_PROFILEINFO'));
     } elseif (!empty($DelSignature)) {
         $user->signature = '';
         $user->save();
         $this->app->enqueueMessage(JText::_('COM_KUNENA_MODERATE_DELETED_BAD_SIGNATURE'));
     }
     if (!empty($banDelPosts)) {
//.........这里部分代码省略.........
开发者ID:proyectoseb,项目名称:University,代码行数:101,代码来源:user.php

示例7: displayBanManager

 /**
  *
  */
 function displayBanManager()
 {
     // TODO: move ban manager somewhere else and add pagination
     $this->bannedusers = KunenaUserBan::getBannedUsers(0, 50);
     if (!empty($this->bannedusers)) {
         KunenaUserHelper::loadUsers(array_keys($this->bannedusers));
     }
     echo $this->loadTemplateFile('banmanager');
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:12,代码来源:view.html.php

示例8: ban

 function ban()
 {
     $userid = JRequest::getInt('userid', 0);
     $ip = JRequest::getVar('ip', '');
     $block = JRequest::getInt('block', 0);
     $expiration = JRequest::getString('expiration', '');
     $reason_private = JRequest::getString('reason_private', '');
     $reason_public = JRequest::getString('reason_public', '');
     $comment = JRequest::getString('comment', '');
     if (!JRequest::checkToken()) {
         while (@ob_end_clean()) {
         }
         $this->_app->redirect(CKunenaLink::GetProfileURL($this->profile->userid, false), COM_KUNENA_ERROR_TOKEN, 'error');
         return false;
     }
     kimport('userban');
     $ban = KunenaUserBan::getInstanceByUserid($userid, true);
     if (!$ban->id) {
         $ban->ban($userid, $ip, $block, $expiration, $reason_private, $reason_public, $comment);
         $success = $ban->save();
     } else {
         $delban = JRequest::getString('delban', '');
         if ($delban) {
             $ban->unBan($comment);
             $success = $ban->save();
         } else {
             $ban->blocked = $block;
             $ban->setExpiration($expiration, $comment);
             $ban->setReason($reason_public, $reason_private);
             $success = $ban->save();
         }
     }
     if ($block) {
         if ($ban->isEnabled()) {
             $message = JText::_('COM_KUNENA_USER_BLOCKED_DONE');
         } else {
             $message = JText::_('COM_KUNENA_USER_UNBLOCKED_DONE');
         }
     } else {
         if ($ban->isEnabled()) {
             $message = JText::_('COM_KUNENA_USER_BANNED_DONE');
         } else {
             $message = JText::_('COM_KUNENA_USER_UNBANNED_DONE');
         }
     }
     if (!$success) {
         $this->_app->enqueueMessage($ban->getError(), 'error');
     } else {
         $this->_app->enqueueMessage($message);
     }
     $banDelPosts = JRequest::getVar('bandelposts', '');
     $DelAvatar = JRequest::getVar('delavatar', '');
     $DelSignature = JRequest::getVar('delsignature', '');
     $DelProfileInfo = JRequest::getVar('delprofileinfo', '');
     if (!empty($DelAvatar)) {
         jimport('joomla.filesystem.file');
         $userprofile = KunenaFactory::getUser($userid);
         $this->_db->setQuery("UPDATE #__kunena_users SET avatar=null WHERE userid={$this->_db->Quote($userid)}");
         $this->_db->Query();
         KunenaError::checkDatabaseError();
         $avatar_deleted = '';
         // Delete avatar from file system
         if (JFile::exists(KUNENA_PATH_AVATAR_UPLOADED . '/' . $userprofile->avatar) && !stristr($userprofile->avatar, 'gallery/')) {
             JFile::delete(KUNENA_PATH_AVATAR_UPLOADED . '/' . $userprofile->avatar);
             $avatar_deleted = $this->_app->enqueueMessage(JText::_('COM_KUNENA_MODERATE_DELETED_BAD_AVATAR_FILESYSTEM'));
         }
         $this->_app->enqueueMessage(JText::_('COM_KUNENA_MODERATE_DELETED_BAD_AVATAR') . $avatar_deleted);
     }
     if (!empty($DelSignature)) {
         $this->_db->setQuery("UPDATE #__kunena_users SET signature=null WHERE userid={$this->_db->Quote($userid)}");
         $this->_db->Query();
         KunenaError::checkDatabaseError();
         $this->_app->enqueueMessage(JText::_('COM_KUNENA_MODERATE_DELETED_BAD_SIGNATURE'));
     }
     if (!empty($DelProfileInfo)) {
         $this->_db->setQuery("UPDATE #__kunena_users SET signature=null,avatar=null,karma=null,personalText=null,gender=0,birthdate=0000-00-00,location=null,ICQ=null,AIM=null,YIM=null,MSN=null,SKYPE=null,GTALK=null,websitename=null,websiteurl=null,rank=0,TWITTER=null,FACEBOOK=null,MYSPACE=null,LINKEDIN=null,DELICIOUS=null,FRIENDFEED=null,DIGG=null,BLOGSPOT=null,FLICKR=null,BEBO=null WHERE userid={$this->_db->Quote($userid)}");
         $this->_db->Query();
         KunenaError::checkDatabaseError();
         $this->_app->enqueueMessage(JText::_('COM_KUNENA_MODERATE_DELETED_BAD_PROFILEINFO'));
     }
     if (!empty($banDelPosts)) {
         //select only the messages which aren't already in the trash
         $this->_db->setQuery("UPDATE #__kunena_messages SET hold=2 WHERE hold!=2 AND userid={$this->_db->Quote($userid)}");
         $idusermessages = $this->_db->loadObjectList();
         KunenaError::checkDatabaseError();
         $this->_app->enqueueMessage(JText::_('COM_KUNENA_MODERATE_DELETED_BAD_MESSAGES'));
     }
     while (@ob_end_clean()) {
     }
     $this->_app->redirect(CKunenaLink::GetProfileURL($this->profile->userid, false));
 }
开发者ID:redigy,项目名称:Kunena-1.6,代码行数:91,代码来源:profile.php

示例9: tryAuthorise

 /**
  * Throws an exception if user isn't authorised to do the action.
  *
  * @param string      $action
  * @param KunenaUser  $user
  * @param bool        $throw
  *
  * @return KunenaExceptionAuthorise|null
  * @throws KunenaExceptionAuthorise
  * @throws InvalidArgumentException
  *
  * @since  K4.0
  */
 public function tryAuthorise($action = 'read', KunenaUser $user = null, $throw = true)
 {
     // Special case to ignore authorisation.
     if ($action == 'none') {
         return null;
     }
     // Load user if not given.
     if ($user === null) {
         $user = KunenaUserHelper::getMyself();
     }
     $config = KunenaConfig::getInstance();
     $exception = null;
     switch ($action) {
         case 'read':
             if (!isset($this->registerDate) || !$user->exists() && !$config->pubprofile) {
                 $exception = new KunenaExceptionAuthorise(JText::_('COM_KUNENA_PROFILEPAGE_NOT_ALLOWED_FOR_GUESTS'), $user->exists() ? 403 : 401);
             }
             break;
         case 'edit':
             if (!isset($this->registerDate) || !$this->isMyself()) {
                 $exception = new KunenaExceptionAuthorise(JText::sprintf('COM_KUNENA_VIEW_USER_EDIT_AUTH_FAILED', $this->getName()), $user->exists() ? 403 : 401);
             }
             break;
         case 'ban':
             $banInfo = KunenaUserBan::getInstanceByUserid($this->userid, true);
             if (!$banInfo->canBan()) {
                 $exception = new KunenaExceptionAuthorise($banInfo->getError(), $user->exists() ? 403 : 401);
             }
             break;
         default:
             throw new InvalidArgumentException(JText::sprintf('COM_KUNENA_LIB_AUTHORISE_INVALID_ACTION', $action), 500);
     }
     // Throw or return the exception.
     if ($throw && $exception) {
         throw $exception;
     }
     return $exception;
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:51,代码来源:user.php

示例10: userban

function userban($option, $userid, $block = 0)
{
    $kunena_app =& JFactory::getApplication();
    if (!JRequest::checkToken()) {
        $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
        while (@ob_end_clean()) {
        }
        $kunena_app->redirect(JURI::base() . "index.php?option={$option}&task=showprofiles");
    }
    kimport('userban');
    $userid = (int) array_shift($userid);
    $ban = KunenaUserBan::getInstanceByUserid($userid, true);
    if (!$ban->id) {
        $ban->ban($userid, null, $block);
        $success = $ban->save();
    } else {
        jimport('joomla.utilities.date');
        $now = new JDate();
        $ban->setExpiration($now);
        $success = $ban->save();
    }
    if ($block) {
        if ($ban->isEnabled()) {
            $message = JText::_('COM_KUNENA_USER_BLOCKED_DONE');
        } else {
            $message = JText::_('COM_KUNENA_USER_UNBLOCK_DONE');
        }
    } else {
        if ($ban->isEnabled()) {
            $message = JText::_('COM_KUNENA_USER_BANNED_DONE');
        } else {
            $message = JText::_('COM_KUNENA_USER_UNBAN_DONE');
        }
    }
    $kunena_app = JFactory::getApplication();
    if (!$success) {
        $kunena_app->enqueueMessage($ban->getError(), 'error');
    } else {
        $kunena_app->enqueueMessage($message);
    }
    while (@ob_end_clean()) {
    }
    $kunena_app->redirect(JURI::base() . "index.php?option=com_kunena&task=profiles");
}
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:44,代码来源:admin.kunena.php

示例11: 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;
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:61,代码来源:display.php

示例12: authoriseNotBanned

	protected function authoriseNotBanned($user) {
		$banned = $user->isBanned();
		if ($banned) {
			$banned = KunenaUserBan::getInstanceByUserid($user->userid, true);
			if (!$banned->isLifetime()) {
				return JText::sprintf ( 'COM_KUNENA_POST_ERROR_USER_BANNED_NOACCESS_EXPIRY', KunenaDate::getInstance($banned->expiration)->toKunena());
			} else {
				return JText::_ ( 'COM_KUNENA_POST_ERROR_USER_BANNED_NOACCESS' );
			}
		}
	}
开发者ID:rich20,项目名称:Kunena,代码行数:11,代码来源:category.php

示例13: unblock

 public function unblock()
 {
     if (!JSession::checkToken('post')) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
         $this->setRedirect(KunenaRoute::_($this->baseurl, false));
         return;
     }
     $cid = JRequest::getVar('cid', array(), 'post', 'array');
     // Array of integers
     JArrayHelper::toInteger($cid);
     $userid = array_shift($cid);
     if ($userid <= 0) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_PROFILE_NO_USER'), 'error');
         $this->setRedirect(KunenaRoute::_($this->baseurl, false));
         return;
     }
     $ban = KunenaUserBan::getInstanceByUserid($userid, true);
     if (!$ban->id) {
         $ban->ban($userid, null, 1);
         $success = $ban->save();
     } else {
         jimport('joomla.utilities.date');
         $now = new JDate();
         $ban->setExpiration($now);
         $success = $ban->save();
     }
     $message = JText::_('COM_KUNENA_USER_UNBLOCK_DONE');
     if (!$success) {
         $this->app->enqueueMessage($ban->getError(), 'error');
     } else {
         $this->app->enqueueMessage($message);
     }
     $this->setRedirect(KunenaRoute::_($this->baseurl, false));
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:34,代码来源:users.php

示例14: displayBanManager

	function displayBanManager() {
		$this->bannedusers = KunenaUserBan::getBannedUsers();
		echo $this->loadTemplate('banmanager');
	}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:4,代码来源:view.html.php

示例15: getTabs

 /**
  * Method to get tabs for user profile
  *
  * @return array
  */
 public function getTabs()
 {
     $banInfo = KunenaUserBan::getInstanceByUserid($this->user->id, true);
     $myProfile = $this->profile->isMyself();
     $moderator = $this->me->isModerator();
     // Decide which tabs to display.
     $showPosts = true;
     $showSubscriptions = $this->config->allowsubscriptions && $myProfile;
     $showFavorites = $this->config->allowfavorites && $myProfile;
     $showThankYou = $this->config->showthankyou && $this->me->exists();
     $showUnapproved = $myProfile && ($this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus());
     $showAttachments = $this->config->show_imgfiles_manage_profile && ($moderator || $myProfile);
     $showBanManager = $moderator && $myProfile;
     $showBanHistory = $banInfo->canBan();
     $showBanUser = $banInfo->canBan();
     // Define all tabs.
     $tabs = array();
     if ($showPosts) {
         $params = array('embedded' => 1, 'topics_categories' => 0, 'topics_catselection' => 1, 'userid' => $this->profile->userid, 'mode' => 'latest', 'sel' => -1, 'limit' => 10, 'filter_order' => 'time', 'limitstart' => 0, 'filter_order_Dir' => 'desc', 'display' => $this->state->get('display', ''));
         $tab = new stdClass();
         $tab->title = JText::_('COM_KUNENA_USERPOSTS');
         $tab->content = $this->subRequest('Message/List/Recent', new JInput($params), $params);
         $tab->active = true;
         $tabs['posts'] = $tab;
     }
     if ($showSubscriptions) {
         $tab = new stdClass();
         $tab->title = JText::_('COM_KUNENA_SUBSCRIPTIONS');
         $tab->content = '';
         if ($this->config->category_subscriptions != 'disabled') {
             $params = array('embedded' => 1, 'userid' => $this->profile->userid, 'limit' => 10, 'filter_order' => 'time', 'limitstart' => 0, 'filter_order_Dir' => 'desc');
             $tab->content .= $this->subRequest('Category/Subscriptions', new JInput($params), $params);
         }
         if ($this->config->topic_subscriptions != 'disabled') {
             $params = array('embedded' => 1, 'topics_categories' => 0, 'topics_catselection' => 1, 'userid' => $this->profile->userid, 'mode' => 'subscriptions', 'sel' => -1, 'limit' => 10, 'filter_order' => 'time', 'limitstart' => 0, 'filter_order_Dir' => 'desc');
             $tab->content .= $this->subRequest('Topic/List/User', new JInput($params), $params);
         }
         $tab->active = false;
         if ($tab->content) {
             $tabs['subscriptions'] = $tab;
         }
     }
     if ($showFavorites) {
         $params = array('embedded' => 1, 'topics_categories' => 0, 'topics_catselection' => 1, 'userid' => $this->profile->userid, 'mode' => 'favorites', 'sel' => -1, 'limit' => 10, 'filter_order' => 'time', 'limitstart' => 0, 'filter_order_Dir' => 'desc');
         $tab = new stdClass();
         $tab->title = JText::_('COM_KUNENA_FAVORITES');
         $tab->content = $this->subRequest('Topic/List/User', new JInput($params), $params);
         $tab->active = false;
         $tabs['favorites'] = $tab;
     }
     if ($showThankYou) {
         $tab = new stdClass();
         $tab->title = JText::_('COM_KUNENA_THANK_YOU');
         $tab->content = '';
         $params = array('embedded' => 1, 'topics_categories' => 0, 'topics_catselection' => 1, 'userid' => $this->profile->userid, 'mode' => 'mythanks', 'sel' => -1, 'limit' => 10, 'filter_order' => 'time', 'limitstart' => 0, 'filter_order_Dir' => 'desc');
         $tab->content .= $this->subRequest('Message/List/Recent', new JInput($params), $params);
         $params = array('embedded' => 1, 'topics_categories' => 0, 'topics_catselection' => 1, 'userid' => $this->profile->userid, 'mode' => 'thankyou', 'sel' => -1, 'limit' => 10, 'filter_order' => 'time', 'limitstart' => 0, 'filter_order_Dir' => 'desc');
         $tab->content .= $this->subRequest('Message/List/Recent', new JInput($params), $params);
         $tab->active = false;
         $tabs['thankyou'] = $tab;
     }
     if ($showUnapproved) {
         $params = array('embedded' => 1, 'topics_categories' => 0, 'topics_catselection' => 1, 'userid' => $this->profile->userid, 'mode' => 'unapproved', 'sel' => -1, 'limit' => 10, 'filter_order' => 'time', 'limitstart' => 0, 'filter_order_Dir' => 'desc');
         $tab = new stdClass();
         $tab->title = JText::_('COM_KUNENA_MESSAGE_ADMINISTRATION');
         $tab->content = $this->subRequest('Message/List/Recent', new JInput($params), $params);
         $tab->active = false;
         $tabs['unapproved'] = $tab;
     }
     if ($showAttachments) {
         $tab = new stdClass();
         $tab->title = JText::_('COM_KUNENA_MANAGE_ATTACHMENTS');
         $tab->content = $this->subRequest('User/Attachments');
         $tab->active = false;
         $tabs['attachments'] = $tab;
     }
     if ($showBanManager) {
         $tab = new stdClass();
         $tab->title = JText::_('COM_KUNENA_BAN_BANMANAGER');
         $tab->content = $this->subRequest('User/Ban/Manager');
         $tab->active = false;
         $tabs['banmanager'] = $tab;
     }
     if ($showBanHistory) {
         $tab = new stdClass();
         $tab->title = JText::_('COM_KUNENA_BAN_BANHISTORY');
         $tab->content = $this->subRequest('User/Ban/History');
         $tab->active = false;
         $tabs['banhistory'] = $tab;
     }
     if ($showBanUser) {
         $tab = new stdClass();
         $tab->title = $banInfo->exists() ? JText::_('COM_KUNENA_BAN_EDIT') : JText::_('COM_KUNENA_BAN_NEW');
         $tab->content = $this->subRequest('User/Ban/Form');
         $tab->active = false;
//.........这里部分代码省略.........
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:101,代码来源:item.php


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