• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP KunenaUser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: filterByUserAccess

 /**
  * Filter by user access to the categories.
  *
  * It is very important to use this or category filter. Otherwise topics from unauthorized categories will be
  * included to the search results.
  *
  * @param KunenaUser $user
  *
  * @return $this
  */
 public function filterByUserAccess(KunenaUser $user)
 {
     $categories = $user->getAllowedCategories();
     $list = implode(',', $categories);
     $this->query->where("a.category_id IN ({$list})");
     return $this;
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:17,代码来源:finder.php


示例2: prepareTopics

 /**
  * Prepare topics by pre-loading needed information.
  *
  * @param   array  $userIds  List of additional user Ids to be loaded.
  * @param   array  $mesIds   List of additional message Ids to be loaded.
  *
  * @return  void
  */
 protected function prepareTopics(array $userIds = array(), array $mesIds = array())
 {
     // Collect user Ids for avatar prefetch when integrated.
     $lastIds = array();
     foreach ($this->topics as $topic) {
         $userIds[(int) $topic->first_post_userid] = (int) $topic->first_post_userid;
         $userIds[(int) $topic->last_post_userid] = (int) $topic->last_post_userid;
         $lastIds[(int) $topic->last_post_id] = (int) $topic->last_post_id;
     }
     // Prefetch all users/avatars to avoid user by user queries during template iterations.
     if (!empty($userIds)) {
         KunenaUserHelper::loadUsers($userIds);
     }
     $topicIds = array_keys($this->topics);
     KunenaForumTopicHelper::getUserTopics($topicIds);
     /* KunenaForumTopicHelper::getKeywords($topicIds); */
     $mesIds += KunenaForumTopicHelper::fetchNewStatus($this->topics);
     // Fetch also last post positions when user can see unapproved or deleted posts.
     // TODO: Optimize? Take account of configuration option...
     if ($this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus()) {
         $mesIds += $lastIds;
     }
     // Load position information for all selected messages.
     if ($mesIds) {
         KunenaForumMessageHelper::loadLocation($mesIds);
     }
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:35,代码来源:display.php


示例3: 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


示例4: before

 /**
  * Prepare user for editing.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     // If profile integration is disabled, this view doesn't exist.
     $integration = KunenaFactory::getProfile();
     if (get_class($integration) == 'KunenaProfileNone') {
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_PROFILE_DISABLED'), 404);
     }
     $userid = $this->input->getInt('userid');
     $this->user = JFactory::getUser($userid);
     $this->profile = KunenaUserHelper::get($userid);
     $this->profile->tryAuthorise('edit');
     $this->headerText = JText::sprintf('COM_KUNENA_VIEW_USER_DEFAULT', $this->profile->getName());
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:21,代码来源:display.php


示例5: before

 /**
  * Prepare category display.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     require_once KPATH_SITE . '/models/category.php';
     $this->model = new KunenaModelCategory();
     $this->me = KunenaUserHelper::getMyself();
     $catid = $this->input->getInt('catid');
     $limitstart = $this->input->getInt('limitstart', 0);
     $limit = $this->input->getInt('limit', 0);
     if ($limit < 1 || $limit > 100) {
         $limit = $this->config->threads_per_page;
     }
     // TODO:
     $direction = 'DESC';
     $this->category = KunenaForumCategoryHelper::get($catid);
     $this->category->tryAuthorise();
     $this->headerText = JText::_('COM_KUNENA_THREADS_IN_FORUM') . ': ' . $this->category->name;
     $topic_ordering = $this->category->topic_ordering;
     $access = KunenaAccess::getInstance();
     $hold = $access->getAllowedHold($this->me, $catid);
     $moved = 1;
     $params = array('hold' => $hold, 'moved' => $moved);
     switch ($topic_ordering) {
         case 'alpha':
             $params['orderby'] = 'tt.ordering DESC, tt.subject ASC ';
             break;
         case 'creation':
             $params['orderby'] = 'tt.ordering DESC, tt.first_post_time ' . $direction;
             break;
         case 'lastpost':
         default:
             $params['orderby'] = 'tt.ordering DESC, tt.last_post_time ' . $direction;
     }
     list($this->total, $this->topics) = KunenaForumTopicHelper::getLatestTopics($catid, $limitstart, $limit, $params);
     if ($this->total > 0) {
         // Collect user ids for avatar prefetch when integrated.
         $userlist = array();
         $lastpostlist = array();
         foreach ($this->topics as $topic) {
             $userlist[intval($topic->first_post_userid)] = intval($topic->first_post_userid);
             $userlist[intval($topic->last_post_userid)] = intval($topic->last_post_userid);
             $lastpostlist[intval($topic->last_post_id)] = intval($topic->last_post_id);
         }
         // Prefetch all users/avatars to avoid user by user queries during template iterations.
         if (!empty($userlist)) {
             KunenaUserHelper::loadUsers($userlist);
         }
         KunenaForumTopicHelper::getUserTopics(array_keys($this->topics));
         KunenaForumTopicHelper::getKeywords(array_keys($this->topics));
         $lastreadlist = KunenaForumTopicHelper::fetchNewStatus($this->topics);
         // Fetch last / new post positions when user can see unapproved or deleted posts.
         if ($lastreadlist || $this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus()) {
             KunenaForumMessageHelper::loadLocation($lastpostlist + $lastreadlist);
         }
     }
     $this->topicActions = $this->model->getTopicActions();
     $this->actionMove = $this->model->getActionMove();
     $this->pagination = new KunenaPagination($this->total, $limitstart, $limit);
     $this->pagination->setDisplayedPages(5);
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:67,代码来源:display.php


示例6: 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:giabmf11,项目名称:Kunena-Forum,代码行数:42,代码来源:display.php


示例7: authoriseAttachmentsFile

 /**
  * Check if user has the right to upload file attachment
  *
  * @param KunenaUser $user
  * @return KunenaExceptionAuthorise|NULL
  */
 protected function authoriseAttachmentsFile(KunenaUser $user)
 {
     if (empty(KunenaFactory::getConfig()->file_upload)) {
         return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_POST_ATTACHMENTS_NOT_ALLOWED'), 403);
     }
     if (KunenaFactory::getConfig()->file_upload == 'admin') {
         if (!$user->isAdmin()) {
             return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_POST_ATTACHMENTS_FILE_ONLY_FOR_ADMINISTRATORS'), 403);
         }
     }
     if (KunenaFactory::getConfig()->file_upload == 'registered') {
         if (!$user->userid) {
             return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_POST_ATTACHMENTS_FILE_ONLY_FOR_REGISTERED_USERS'), 403);
         }
     }
     if (KunenaFactory::getConfig()->file_upload == 'moderator') {
         if (!$user->isModerator()) {
             return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_POST_ATTACHMENTS_FILE_ONLY_FOR_MODERATORS'), 403);
         }
     }
     return null;
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:28,代码来源:message.php


示例8: authoriseOwn

 protected function authoriseOwn(KunenaUser $user)
 {
     // Checks if attachment is users own or user is moderator in the category (or global)
     if ($user->userid && $this->userid != $user->userid && !$user->isModerator($this->getMessage()->getCategory())) {
         $this->setError(JText::_('COM_KUNENA_NO_ACCESS'));
         return false;
     }
     return true;
 }
开发者ID:laiello,项目名称:senluonirvana,代码行数:9,代码来源:attachment.php


示例9: loadUsers

 /**
  * @param array $userids
  *
  * @return array
  */
 public static function loadUsers(array $userids = array())
 {
     KUNENA_PROFILER ? KunenaProfiler::instance()->start('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
     // Make sure that userids are unique and that indexes are correct
     $e_userids = array();
     foreach ($userids as $userid) {
         // Ignore guests and imported users, which haven't been mapped to Joomla (id<0).
         if ($userid > 0 && empty(self::$_instances[$userid])) {
             $e_userids[(int) $userid] = (int) $userid;
         }
     }
     if (!empty($e_userids)) {
         $userlist = implode(',', $e_userids);
         $db = JFactory::getDBO();
         $query = "SELECT u.name, u.username, u.email, u.block as blocked, u.registerDate, u.lastvisitDate, ku.*, u.id AS userid\n\t\t\t\tFROM #__users AS u\n\t\t\t\tLEFT JOIN #__kunena_users AS ku ON u.id = ku.userid\n\t\t\t\tWHERE u.id IN ({$userlist})";
         $db->setQuery($query);
         $results = $db->loadAssocList();
         KunenaError::checkDatabaseError();
         foreach ($results as $user) {
             $instance = new KunenaUser(false);
             $instance->setProperties($user);
             $instance->exists(isset($user['posts']));
             self::$_instances[$instance->userid] = $instance;
         }
         // Preload avatars if configured
         $avatars = KunenaFactory::getAvatarIntegration();
         $avatars->load($e_userids);
     }
     $list = array();
     foreach ($userids as $userid) {
         if (isset(self::$_instances[$userid])) {
             $list[$userid] = self::$_instances[$userid];
         }
     }
     KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
     return $list;
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:42,代码来源:helper.php


示例10: authoriseAdmin

 /**
  * @param KunenaUser $user
  *
  * @return KunenaExceptionAuthorise|null
  */
 protected function authoriseAdmin(KunenaUser $user)
 {
     // Check that user is admin
     if (!$user->userid) {
         return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_MODERATION_ERROR_NOT_ADMIN'), 401);
     }
     if (!$user->isAdmin($this)) {
         return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_MODERATION_ERROR_NOT_ADMIN'), 403);
     }
     return null;
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:16,代码来源:category.php


示例11: authoriseDelete

	/**
	 * @param KunenaUser $user
	 *
	 * @return bool
	 */
	protected function authoriseDelete(KunenaUser $user) {
		$config = KunenaFactory::getConfig();
		if (!$user->isModerator($this->getCategory())
				&& $config->userdeletetmessage != '2' && ($config->userdeletetmessage == '0' || $this->getTopic()->last_post_id != $this->id)) {
			$this->setError (JText::_ ( 'COM_KUNENA_POST_ERROR_DELETE_REPLY_AFTER' ) );
			return false;
		}
		return true;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:14,代码来源:message.php


示例12: authoriseOwn

 /**
  * @param KunenaUser $user
  *
  * @return KunenaExceptionAuthorise|null
  *
  * @since  K4.0
  */
 protected function authoriseOwn(KunenaUser $user)
 {
     // Checks if attachment is users own or user is moderator in the category (or global)
     if ($user->userid && $this->userid != $user->userid && !$user->isModerator($this->getMessage()->getCategory())) {
         return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_ATTACHMENT_NO_ACCESS'), 403);
     }
     return null;
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:15,代码来源:attachment.php


示例13: loadUsers

 public static function loadUsers(array $userids = array())
 {
     // Make sure that userids are unique and that indexes are correct
     $e_userids = array();
     foreach ($userids as &$userid) {
         if (!$userid || $userid != intval($userid)) {
             unset($userid);
         } elseif (empty(self::$_instances[$userid])) {
             $e_userids[$userid] = $userid;
         }
     }
     if (!empty($e_userids)) {
         $userlist = implode(',', $e_userids);
         $db = JFactory::getDBO();
         $query = "SELECT u.name, u.username, u.email, u.block as blocked, u.registerDate, u.lastvisitDate, ku.*\n\t\t\t\tFROM #__users AS u\n\t\t\t\tLEFT JOIN #__kunena_users AS ku ON u.id = ku.userid\n\t\t\t\tWHERE u.id IN ({$userlist})";
         $db->setQuery($query);
         $results = $db->loadAssocList();
         KunenaError::checkDatabaseError();
         foreach ($results as $user) {
             $instance = new KunenaUser(false);
             $instance->setProperties($user);
             $instance->exists(true);
             self::$_instances[$instance->userid] = $instance;
         }
         // Preload avatars if configured
         $avatars = KunenaFactory::getAvatarIntegration();
         $avatars->load($e_userids);
     }
     $list = array();
     foreach ($userids as $userid) {
         if (isset(self::$_instances[$userid])) {
             $list[$userid] = self::$_instances[$userid];
         }
     }
     return $list;
 }
开发者ID:laiello,项目名称:senluonirvana,代码行数:36,代码来源:helper.php


示例14: _common

 protected function _common()
 {
     $this->totalpages = ceil($this->total / $this->threads_per_page);
     if (!empty($this->threadids)) {
         $idstr = implode(",", $this->threadids);
         if (empty($this->loadids)) {
             $loadstr = '';
         } else {
             $loadstr = 'OR a.id IN (' . implode(",", $this->loadids) . ')';
         }
         $query = "SELECT a.*, j.id AS userid, t.message, l.myfavorite, l.favcount, l.threadhits, l.lasttime, l.threadattachments, COUNT(aa.id) AS attachments,\n\t\t\t\tl.msgcount, l.mycount, l.lastid, l.mylastid, l.lastid AS lastread, 0 AS unread, u.avatar, j.username, j.name AS uname, c.name AS catname, c.class_sfx\n\t\t\tFROM (\n\t\t\t\tSELECT m.thread, MAX(m.hits) AS threadhits, MAX(f.userid IS NOT null AND f.userid={$this->db->Quote($this->my->id)}) AS myfavorite, COUNT(DISTINCT f.userid) AS favcount,\n\t\t\t\t\tCOUNT(DISTINCT a.id) AS threadattachments, COUNT(DISTINCT m.id) AS msgcount, COUNT(DISTINCT IF(m.userid={$this->db->Quote($this->user->id)}, m.id, NULL)) AS mycount,\n\t\t\t\t\tMAX(m.id) AS lastid, MAX(IF(m.userid={$this->db->Quote($this->user->id)}, m.id, 0)) AS mylastid, MAX(m.time) AS lasttime\n\t\t\t\tFROM #__kunena_messages AS m";
         if ($this->config->allowfavorites) {
             $query .= " LEFT JOIN #__kunena_favorites AS f ON f.thread = m.thread";
         } else {
             $query .= " LEFT JOIN #__kunena_favorites AS f ON f.thread = 0";
         }
         $query .= "\n\t\t\t\tLEFT JOIN #__kunena_attachments AS a ON a.mesid = m.id\n\t\t\t\tWHERE m.hold IN ({$this->hold}) AND m.moved='0' AND m.thread IN ({$idstr})\n\t\t\t\tGROUP BY thread\n\t\t\t) AS l\n\t\t\tINNER JOIN #__kunena_messages AS a ON a.thread = l.thread\n\t\t\tINNER JOIN #__kunena_messages_text AS t ON a.id = t.mesid\n\t\t\tLEFT JOIN #__users AS j ON j.id = a.userid\n\t\t\tLEFT JOIN #__kunena_users AS u ON u.userid = j.id\n\t\t\tLEFT JOIN #__kunena_categories AS c ON c.id = a.catid\n\t\t\tLEFT JOIN #__kunena_attachments AS aa ON aa.mesid = a.id\n\t\t\tWHERE (a.parent='0' OR a.id=l.lastid {$loadstr})\n\t\t\tGROUP BY a.id\n\t\t\tORDER BY {$this->order}";
         $this->db->setQuery($query);
         $this->messages = $this->db->loadObjectList('id');
         KunenaError::checkDatabaseError();
         // collect user ids for avatar prefetch when integrated
         $userlist = array();
         foreach ($this->messages as $message) {
             if ($message->parent == 0) {
                 $this->threads[$message->thread] = $message;
                 $routerlist[$message->id] = $message->subject;
                 if ($this->func == 'mylatest' && $message->myfavorite) {
                     $this->highlight++;
                 }
             }
             if ($message->id == $message->lastid) {
                 $this->lastreply[$message->thread] = $message;
             }
             if (isset($this->loadids) && in_array($message->id, $this->loadids)) {
                 $this->customreply[$message->id] = $message;
             }
             $userlist[intval($message->userid)] = intval($message->userid);
             $userlist[intval($message->modified_by)] = intval($message->modified_by);
         }
         // Load threads to Kunena router to avoid extra SQL queries
         if (!empty($routerlist)) {
             include_once KUNENA_PATH . '/router.php';
             KunenaRouter::loadMessages($routerlist);
         }
         // Prefetch all users/avatars to avoid user by user queries during template iterations
         KunenaUser::loadUsers($userlist);
         if ($this->config->shownew && $this->my->id) {
             $readlist = $this->session->readtopics;
             $this->db->setQuery("SELECT thread, MIN(id) AS lastread, SUM(1) AS unread FROM #__kunena_messages " . "WHERE hold IN ({$this->hold}) AND moved='0' AND thread NOT IN ({$readlist}) AND thread IN ({$idstr}) AND time>{$this->db->Quote($this->prevCheck)} GROUP BY thread");
             // TODO: check input
             $msgidlist = $this->db->loadObjectList();
             KunenaError::checkDatabaseError();
             foreach ($msgidlist as $msgid) {
                 $this->messages[$msgid->thread]->lastread = $msgid->lastread;
                 $this->messages[$msgid->thread]->unread = $msgid->unread;
             }
         }
     }
 }
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:59,代码来源:latestx.php


示例15: getUserSettings

 /**
  * Puts user forum settings into object
  *
  * @param moscomprofilerUser $user
  * @param object             $forum
  * @param mixed              $additional
  * @return object
  */
 function getUserSettings($user, $forum, $additional = null)
 {
     global $_CB_database;
     static $cache = array();
     if (!isset($cache[$user->id])) {
         if ($forum->prefix != 'kunena' || $forum->prefix == 'kunena' && !class_exists('KunenaForum')) {
             $query = 'SELECT f.*' . $additional . "\n FROM " . $_CB_database->NameQuote('#__' . $forum->prefix . '_users') . 'AS f' . ', ' . $_CB_database->NameQuote('#__users') . 'AS u' . "\n WHERE f." . $_CB_database->NameQuote('userid') . " = u." . $_CB_database->NameQuote('id') . "\n AND f." . $_CB_database->NameQuote('userid') . " = " . (int) $user->id;
             $_CB_database->setQuery($query, 0, 1);
             $settings = null;
             $_CB_database->loadObject($settings);
         } elseif (class_exists('KunenaUser')) {
             $settings = KunenaUser::getInstance((int) $user->id);
         } else {
             $settings = null;
         }
         $cache[$user->id] = $settings ? $settings : null;
     }
     return $cache[$user->id];
 }
开发者ID:rogatnev-nikita,项目名称:cloudinterpreter,代码行数:27,代码来源:cb.simpleboardtab.model.php


示例16: getTotalGuestUsers

 public function getTotalGuestUsers()
 {
     if (!$this->config->regonly) {
         $count = KunenaUser::getOnlineCount();
         return $count['guest'];
     }
     return 0;
 }
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:8,代码来源:kunena.who.class.php


示例17: loadUsers

	static public function loadUsers($userids = array()) {
		if (!is_array($userids)) {
			JError::raiseError ( 500, __CLASS__ . '::' . __FUNCTION__.'(): Parameter $userids is not array' );
		}

		// Make sure that userids are unique and that indexes are correct
		$e_userids = array();
		foreach($userids as $userid){
			if (empty ( self::$_instances [intval($userid)] )) $e_userids[intval($userid)] = intval($userid);
		}
		unset($e_userids[0]);
		if (empty($e_userids)) return array();

		$userlist = implode ( ',', $e_userids );

		$db = JFactory::getDBO ();
		$query = "SELECT u.name, u.username, u.email, u.block as blocked, u.registerDate, u.lastvisitDate, ku.*
			FROM #__users AS u
			LEFT JOIN #__kunena_users AS ku ON u.id = ku.userid
			WHERE u.id IN ({$userlist})";
		$db->setQuery ( $query );
		$results = $db->loadAssocList ();
		KunenaError::checkDatabaseError ();

		$list = array ();
		foreach ( $results as $user ) {
			$instance = new KunenaUser (false);
			$instance->setProperties ( $user );
			$instance->exists(true);
			self::$_instances [$instance->userid] = $instance;
		}

		// Finally call integration preload as well
		// Preload avatars if configured
		$avatars = KunenaFactory::getAvatarIntegration();
		$avatars->load($userids);

		foreach ($userids as $userid) {
			if (isset(self::$_instances [$userid])) $list [$userid] = self::$_instances [$userid];
		}
		return $list;
	}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:42,代码来源:helper.php


示例18: authoriseUnlocked

 /**
  * @param KunenaUser $user
  *
  * @return null|string
  */
 protected function authoriseUnlocked(KunenaUser $user)
 {
     // Check that topic is not locked or user is a moderator
     if ($this->locked && !$user->isModerator($this->getCategory())) {
         return JText::_('COM_KUNENA_POST_ERROR_TOPIC_LOCKED');
     }
     return null;
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:13,代码来源:topic.php


示例19: 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.
//.........这里部分代码省略.........
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:101,代码来源:display.php


示例20: before

 /**
  * Prepare topic display.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $catid = $this->input->getInt('catid', 0);
     $id = $this->input->getInt('id', 0);
     $mesid = $this->input->getInt('mesid', 0);
     $start = $this->input->getInt('limitstart', 0);
     $limit = $this->input->getInt('limit', 0);
     if ($limit < 1 || $limit > 100) {
         $limit = $this->config->messages_per_page;
     }
     $this->me = KunenaUserHelper::getMyself();
     // Load topic and message.
     if ($mesid) {
         // If message was set, use it to find the current topic.
         $this->message = KunenaForumMessageHelper::get($mesid);
         $this->topic = $this->message->getTopic();
     } else {
         // Note that redirect loops throw RuntimeException because of we added KunenaForumTopic::getTopic() call!
         $this->topic = KunenaForumTopicHelper::get($id)->getTopic();
         $this->message = KunenaForumMessageHelper::get($this->topic->first_post_id);
     }
     // Load also category (prefer the URI variable if available).
     if ($catid && $catid != $this->topic->category_id) {
         $this->category = KunenaForumCategoryHelper::get($catid);
         $this->category->tryAuthorise();
     } else {
         $this->category = $this->topic->getCategory();
     }
     // Access check.
     $this->message->tryAuthorise();
     // Check if we need to redirect (category or topic mismatch, or resolve permanent URL).
     if ($this->primary) {
         $channels = $this->category->getChannels();
         if ($this->message->thread != $this->topic->id || $this->topic->category_id != $this->category->id && !isset($channels[$this->topic->category_id]) || $mesid && $this->layout != 'threaded') {
             while (@ob_end_clean()) {
             }
             $this->app->redirect($this->message->getUrl(null, false));
         }
     }
     // Load messages from the current page and set the pagination.
     $hold = KunenaAccess::getInstance()->getAllowedHold($this->me, $this->category->id, false);
     $finder = new KunenaForumMessageFinder();
     $finder->where('thread', '=', $this->topic->id)->filterByHold($hold);
     $start = $mesid ? $this->topic->getPostLocation($mesid) : $start;
     $this->pagination = new KunenaPagination($finder->count(), $start, $limit);
     $this->messages = $finder->order('time', $this->me->getMessageOrdering() == 'asc' ? 1 : -1)->start($this->pagination->limitstart)->limit($this->pagination->limit)->find();
     $this->prepareMessages($mesid);
     // Run events.
     $params = new JRegistry();
     $params->set('ksource', 'kunena');
     $params->set('kunena_view', 'topic');
     $params->set('kunena_layout', 'default');
     $dispatcher = JEventDispatcher::getInstance();
     JPluginHelper::importPlugin('kunena');
     $dispatcher->trigger('onKunenaPrepare', array('kunena.topic', &$this->topic, &$params, 0));
     $dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->messages, &$params, 0));
     // Get user data, captcha & quick reply.
     $this->userTopic = $this->topic->getUserTopic();
     $this->quickReply = $this->topic->isAuthorised('reply') && $this->me->exists();
     $this->headerText = JText::_('COM_KUNENA_TOPIC') . ' ' . html_entity_decode($this->topic->displayField('subject'));
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:69,代码来源:display.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP KunenaUserBan类代码示例发布时间:2022-05-23
下一篇:
PHP KunenaTemplate类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap