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

PHP KunenaUserHelper类代码示例

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

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



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

示例1: before

	/**
	 * Prepare search results display.
	 *
	 * @return void
	 */
	protected function before()
	{
		parent::before();

		require_once KPATH_SITE . '/models/search.php';
		$this->model = new KunenaModelSearch(array(), $this->input);
		$this->model->initialize($this->getOptions(), $this->getOptions()->get('embedded', false));
		$this->state = $this->model->getState();

		$this->me = KunenaUserHelper::getMyself();
		$this->message_ordering = $this->me->getMessageOrdering();

		$this->searchwords = $this->model->getSearchWords();
		$this->isModerator = ($this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus());

		$this->results = array();
		$this->total = $this->model->getTotal();
		$this->results = $this->model->getResults();

		$this->pagination = new KunenaPagination(
			$this->total,
			$this->state->get('list.start'),
			$this->state->get('list.limit')
		);

		$this->error = $this->model->getError();
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:32,代码来源:display.php


示例2: __construct

	function __construct($config = array()){
		parent::__construct($config);
		$this->profiler = KunenaProfiler::instance('Kunena');
		$this->me = KunenaUserHelper::getMyself();
		$this->config = KunenaFactory::getConfig();
		$this->template = KunenaFactory::getTemplate();
	}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:7,代码来源:view.php


示例3: __construct

 public function __construct($config = array())
 {
     $name = isset($config['name']) ? $config['name'] : $this->getName();
     $this->document = JFactory::getDocument();
     $this->document->setBase('');
     $this->profiler = KunenaProfiler::instance('Kunena');
     $this->app = JFactory::getApplication();
     $this->me = KunenaUserHelper::getMyself();
     $this->config = KunenaFactory::getConfig();
     $this->ktemplate = KunenaFactory::getTemplate();
     // Set the default template search path
     if ($this->app->isSite() && !isset($config['template_path'])) {
         $config['template_path'] = $this->ktemplate->getTemplatePaths("html/{$name}", true);
     }
     if ($this->app->isAdmin()) {
         $templateAdmin = KunenaFactory::getAdminTemplate();
         $templateAdmin->initialize();
         $config['template_path'] = $templateAdmin->getTemplatePaths($name);
     }
     parent::__construct($config);
     if ($this->app->isSite()) {
         // Add another template file lookup path specific to the current template
         $fallback = JPATH_THEMES . "/{$this->app->getTemplate()}/html/com_kunena/{$this->ktemplate->name}/{$this->getName()}";
         $this->addTemplatePath($fallback);
     }
     // Use our own browser side cache settings.
     JResponse::allowCache(false);
     JResponse::setHeader('Expires', 'Mon, 1 Jan 2001 00:00:00 GMT', true);
     JResponse::setHeader('Last-Modified', gmdate("D, d M Y H:i:s") . ' GMT', true);
     JResponse::setHeader('Cache-Control', 'no-store, must-revalidate, post-check=0, pre-check=0', true);
 }
开发者ID:proyectoseb,项目名称:University,代码行数:31,代码来源:view.php


示例4: recount

	function recount() {
		$app = JFactory::getApplication ();
		$state = $app->getUserState ( 'com_kunena.admin.recount', null );

		if ($state === null) {
			// First run
			$query = "SELECT MAX(id) FROM #__kunena_messages";
			$db = JFactory::getDBO();
			$db->setQuery ( $query );
			$state = new StdClass();
			$state->step = 0;
			$state->maxId = (int) $db->loadResult ();
			$state->start = 0;
		}

		$this->checkTimeout();
		while (1) {
			$count = mt_rand(95000, 105000);
			switch ($state->step) {
				case 0:
					// Update topic statistics
					kimport('kunena.forum.topic.helper');
					KunenaForumTopicHelper::recount(false, $state->start, $state->start+$count);
					$state->start += $count;
					//$app->enqueueMessage ( JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_TOPICS', min($state->start, $state->maxId), $state->maxId) );
					break;
				case 1:
					// Update usertopic statistics
					kimport('kunena.forum.topic.user.helper');
					KunenaForumTopicUserHelper::recount(false, $state->start, $state->start+$count);
					$state->start += $count;
					//$app->enqueueMessage ( JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_USERTOPICS', min($state->start, $state->maxId), $state->maxId) );
					break;
				case 2:
					// Update user statistics
					kimport('kunena.user.helper');
					KunenaUserHelper::recount();
					//$app->enqueueMessage ( JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_USER') );
					break;
				case 3:
					// Update category statistics
					kimport('kunena.forum.category.helper');
					KunenaForumCategoryHelper::recount();
					//$app->enqueueMessage ( JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_CATEGORY') );
					break;
				default:
					$app->setUserState ( 'com_kunena.admin.recount', null );
					$app->enqueueMessage (JText::_('COM_KUNENA_RECOUNTFORUMS_DONE'));
					$this->setRedirect(KunenaRoute::_('index.php?option=com_kunena', false));
					return;
			}
			if (!$state->start || $state->start > $state->maxId) {
				$state->step++;
				$state->start = 0;
			}
			if ($this->checkTimeout()) break;
		}
		$app->setUserState ( 'com_kunena.admin.recount', $state );
		$this->setRedirect(KunenaRoute::_('index.php?option=com_kunena&view=recount&task=recount', false));
	}
开发者ID:rich20,项目名称:Kunena,代码行数:60,代码来源:recount.php


示例5: check

	function check() {
		$user = KunenaUserHelper::get($this->userid);
		if (!$user->exists()) {
			$this->setError ( JText::sprintf ( 'COM_KUNENA_LIB_TABLE_SESSIONS_ERROR_USER_INVALID', (int) $user->userid ) );
		}
		return ($this->getError () == '');
	}
开发者ID:rich20,项目名称:Kunena,代码行数:7,代码来源:kunenasessions.php


示例6: before

	/**
	 * Load user profile.
	 *
	 * @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');

		require_once KPATH_SITE . '/models/user.php';
		$this->model = new KunenaModelUser(array(), $this->input);
		$this->model->initialize($this->getOptions(), $this->getOptions()->get('embedded', false));
		$this->state = $this->model->getState();

		$this->me = KunenaUserHelper::getMyself();
		$this->user = JFactory::getUser($userid);
		$this->profile = KunenaUserHelper::get($userid);
		$this->profile->tryAuthorise('read');

		// Update profile hits.
		if (!$this->profile->exists() || !$this->profile->isMyself())
		{
			$this->profile->uhits++;
			$this->profile->save();
		}

		$this->headerText = JText::sprintf('COM_KUNENA_VIEW_USER_DEFAULT', $this->profile->getName());
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:40,代码来源:display.php


示例7: before

 /**
  * Prepare report message form.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $id = $this->input->getInt('id');
     $mesid = $this->input->getInt('mesid');
     $me = KunenaUserHelper::getMyself();
     if (!$this->config->reportmsg) {
         // Deny access if report feature has been disabled.
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 404);
     }
     if (!$me->exists()) {
         // Deny access if user is guest.
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 401);
     }
     if (!$mesid) {
         $this->topic = KunenaForumTopicHelper::get($id);
         $this->topic->tryAuthorise();
     } else {
         $this->message = KunenaForumMessageHelper::get($mesid);
         $this->message->tryAuthorise();
         $this->topic = $this->message->getTopic();
     }
     $this->category = $this->topic->getCategory();
     $this->uri = "index.php?option=com_kunena&view=topic&layout=report&catid={$this->category->id}" . "&id={$this->topic->id}" . ($this->message ? "&mesid={$this->message->id}" : '');
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:32,代码来源:display.php


示例8: check

	public function check() {
		$user = KunenaUserHelper::get($this->userid);
		$message = KunenaForumMessageHelper::get($this->mesid);
		if ($this->userid != 0 && !$user->exists()) {
			$this->setError(JText::sprintf('COM_KUNENA_LIB_TABLE_ATTACHMENTS_ERROR_USER_INVALID', (int) $user->userid));
		}
		if (!$message->exists()) {
			$this->setError(JText::sprintf('COM_KUNENA_LIB_TABLE_ATTACHMENTS_ERROR_MESSAGE_INVALID', (int) $message->id));
		}
		$this->folder = trim($this->folder, '/');
		if (!$this->folder) {
			$this->setError(JText::_('COM_KUNENA_LIB_TABLE_ATTACHMENTS_ERROR_NO_FOLDER'));
		}
		if (!$this->filename) {
			$this->setError(JText::_('COM_KUNENA_LIB_TABLE_ATTACHMENTS_ERROR_NO_FILENAME'));
		}
		$file = JPATH_ROOT . "/{$this->folder}/{$this->filename}";
		if (!file_exists($file)) {
			$this->setError(JText::sprintf('COM_KUNENA_LIB_TABLE_ATTACHMENTS_ERROR_FILE_MISSING', "{$this->folder}/{$this->filename}"));
		} else {
			if (!$this->hash) $this->hash = md5_file ( $file );
			if (!$this->size) $this->size = filesize ( $file );
		}
		return ($this->getError () == '');
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:25,代码来源:kunenaattachments.php


示例9: markRead

 public static function markRead(array $ids, $user = null)
 {
     $user = KunenaUserHelper::get($user);
     $items = self::getCategories($ids, $user);
     $updateList = array();
     $insertList = array();
     $db = JFactory::getDbo();
     $time = JFactory::getDate()->toUnix();
     foreach ($items as $item) {
         if ($item->exists()) {
             $updateList[] = (int) $item->category_id;
         } else {
             $insertList[] = "{$db->quote($user->userid)}, {$db->quote($item->category_id)}, {$db->quote($time)}";
         }
     }
     if ($updateList) {
         $idlist = implode(',', $updateList);
         $query = $db->getQuery(true);
         $query->update('#__kunena_user_categories')->set("allreadtime={$db->quote($time)}")->where("user_id={$db->quote($user->userid)}")->where("category_id IN ({$idlist})");
         $db->setQuery($query);
         $db->execute();
     }
     if ($insertList) {
         $query = $db->getQuery(true);
         $query->insert('#__kunena_user_categories')->columns('user_id, category_id, allreadtime')->values($insertList);
         $db->setQuery($query);
         $db->execute();
     }
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:29,代码来源:helper.php


示例10: before

	/**
	 * Prepare announcement list display.
	 *
	 * @return void
	 */
	protected function before()
	{
		parent::before();

		$limit = $this->input->getInt('limit', 0);

		if ($limit < 1 || $limit > 100)
		{
			$limit = 20;
		}

		$limitstart = $this->input->getInt('limitstart', 0);

		if ($limitstart < 0)
		{
			$limitstart = 0;
		}

		$moderator = KunenaUserHelper::getMyself()->isModerator();
		$this->pagination = new KunenaPagination(KunenaForumAnnouncementHelper::getCount(!$moderator), $limitstart, $limit);
		$this->announcements = KunenaForumAnnouncementHelper::getAnnouncements(
			$this->pagination->limitstart,
			$this->pagination->limit,
			!$moderator
		);
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:31,代码来源:display.php


示例11: before

 /**
  * Prepare reply history display.
  *
  * @return void
  */
 protected function before()
 {
     parent::before();
     $id = $this->input->getInt('id');
     $this->topic = KunenaForumTopicHelper::get($id);
     $this->history = KunenaForumMessageHelper::getMessagesByTopic($this->topic, 0, (int) $this->config->historylimit, 'DESC');
     $this->replycount = $this->topic->getReplies();
     $this->historycount = count($this->history);
     KunenaAttachmentHelper::getByMessage($this->history);
     $userlist = array();
     foreach ($this->history as $message) {
         $userlist[(int) $message->userid] = (int) $message->userid;
     }
     KunenaUserHelper::loadUsers($userlist);
     // Run events
     $params = new JRegistry();
     $params->set('ksource', 'kunena');
     $params->set('kunena_view', 'topic');
     $params->set('kunena_layout', 'history');
     $dispatcher = JEventDispatcher::getInstance();
     JPluginHelper::importPlugin('kunena');
     $dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->history, &$params, 0));
     // FIXME: need to improve BBCode class on this...
     $this->attachments = KunenaAttachmentHelper::getByMessage($this->history);
     $this->inline_attachments = array();
     $this->headerText = JText::_('COM_KUNENA_POST_EDIT') . ' ' . $this->topic->subject;
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:32,代码来源:display.php


示例12: displayDefault

 function displayDefault()
 {
     $this->categories = $this->get('AdminCategories');
     $this->pagination = $this->get('AdminNavigation');
     // Preprocess the list of items to find ordering divisions.
     $this->ordering = array();
     foreach ($this->categories as &$item) {
         $this->ordering[$item->parent_id][] = $item->id;
     }
     $this->setToolBarDefault();
     $this->sortFields = $this->getSortFields();
     $this->sortDirectionFields = $this->getSortDirectionFields();
     $this->user = JFactory::getUser();
     $this->me = KunenaUserHelper::getMyself();
     $this->userId = $this->user->get('id');
     $this->filterSearch = $this->escape($this->state->get('filter.search'));
     $this->filterPublished = $this->escape($this->state->get('filter.published'));
     $this->filterTitle = $this->escape($this->state->get('filter.title'));
     $this->filterType = $this->escape($this->state->get('filter.type'));
     $this->filterAccess = $this->escape($this->state->get('filter.access'));
     $this->filterLocked = $this->escape($this->state->get('filter.locked'));
     $this->filterReview = $this->escape($this->state->get('filter.review'));
     $this->filterAllow_polls = $this->escape($this->state->get('filter.allow_polls'));
     $this->filterAnonymous = $this->escape($this->state->get('filter.anonymous'));
     $this->filterActive = $this->escape($this->state->get('filter.active'));
     $this->listOrdering = $this->escape($this->state->get('list.ordering'));
     $this->listDirection = $this->escape($this->state->get('list.direction'));
     $this->saveOrder = $this->listOrdering == 'a.ordering' && $this->listDirection == 'asc';
     $this->saveOrderingUrl = 'index.php?option=com_kunena&view=categories&task=saveorderajax&tmpl=component';
     $this->display();
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:31,代码来源:view.html.php


示例13: before

	/**
	 * Change topic layout to threaded.
	 *
	 * @return void
	 */
	protected function before()
	{
		$layout = $this->input->getWord('layout');
		KunenaUserHelper::getMyself()->setTopicLayout($layout);

		parent::before();
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:12,代码来源:display.php


示例14: before

 /**
  * Load user list.
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $config = KunenaConfig::getInstance();
     if ($config->userlist_allowed && JFactory::getUser()->guest) {
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), '401');
     }
     require_once KPATH_SITE . '/models/user.php';
     $this->model = new KunenaModelUser(array(), $this->input);
     $this->model->initialize($this->getOptions(), $this->getOptions()->get('embedded', false));
     $this->state = $this->model->getState();
     $this->me = KunenaUserHelper::getMyself();
     $this->config = KunenaConfig::getInstance();
     $start = $this->state->get('list.start');
     $limit = $this->state->get('list.limit');
     // Get list of super admins to exclude or not in filter by configuration.
     $filter = JAccess::getUsersByGroup(8);
     $finder = new KunenaUserFinder();
     $finder->filterByConfiguration($filter)->filterByName($this->state->get('list.search'));
     $this->total = $finder->count();
     $this->pagination = new KunenaPagination($this->total, $start, $limit);
     $alias = 'ku';
     $aliasList = array('id', 'name', 'username', 'email', 'block', 'registerDate', 'lastvisitDate');
     if (in_array($this->state->get('list.ordering'), $aliasList)) {
         $alias = 'a';
     }
     $this->users = $finder->order($this->state->get('list.ordering'), $this->state->get('list.direction') == 'asc' ? 1 : -1, $alias)->start($this->pagination->limitstart)->limit($this->pagination->limit)->find();
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:33,代码来源:display.php


示例15: getProfileURL

 /**
  * @param        $user
  * @param string $task
  * @param bool   $xhtml
  *
  * @return bool
  */
 public function getProfileURL($user, $task = '', $xhtml = true)
 {
     if ($user == 0) {
         return false;
     }
     if (!$user instanceof KunenaUser) {
         $user = KunenaUserHelper::get($user);
     }
     if ($user === false) {
         return false;
     }
     $userid = "&userid={$user->userid}";
     if ($task && $task != 'edit') {
         // TODO: remove in the future.
         $do = $task ? '&do=' . $task : '';
         return KunenaRoute::_("index.php?option=com_kunena&func=profile{$do}{$userid}", $xhtml);
     } else {
         $layout = $task ? '&layout=' . $task : '';
         if ($layout) {
             return KunenaRoute::_("index.php?option=com_kunena&view=user{$layout}{$userid}", $xhtml);
         } else {
             return KunenaRoute::getUserUrl($user, $xhtml);
         }
     }
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:32,代码来源:profile.php


示例16: getTopics

	/**
	 * @param bool|array $ids
	 * @param mixed $user
	 *
	 * @return KunenaForumTopicUserRead[]
	 */
	static public function getTopics($ids = false, $user = null)
	{
		$user = KunenaUserHelper::get($user);

		if ($ids === false)
		{
			return isset(self::$_instances[$user->userid]) ? self::$_instances[$user->userid] : array();
		}
		elseif (!is_array ($ids))
		{
			$ids = array($ids);
		}

		// Convert topic objects into ids
		foreach ($ids as $i=>$id)
		{
			if ($id instanceof KunenaForumTopic) $ids[$i] = $id->id;
		}

		$ids = array_unique($ids);
		self::loadTopics($ids, $user);

		$list = array ();
		foreach ( $ids as $id )
		{
			if (!empty(self::$_instances [$user->userid][$id])) {
				$list [$id] = self::$_instances [$user->userid][$id];
			}
		}

		return $list;
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:38,代码来源:helper.php


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


示例18: before

 /**
  * Prepare login display.
  *
  * @return boolean
  */
 protected function before()
 {
     parent::before();
     $login = KunenaLogin::getInstance();
     if (!$login->enabled()) {
         return false;
     }
     $this->me = KunenaUserHelper::getMyself();
     $this->name = $this->me->exists() ? 'Widget/Login/Logout' : 'Widget/Login/Login';
     $this->my = JFactory::getUser();
     if ($this->my->guest) {
         $this->registrationUrl = $login->getRegistrationUrl();
         $this->resetPasswordUrl = $login->getResetUrl();
         $this->remindUsernameUrl = $login->getRemindUrl();
         $this->rememberMe = $login->getRememberMe();
     } else {
         $this->lastvisitDate = KunenaDate::getInstance($this->my->lastvisitDate);
         $private = KunenaFactory::getPrivateMessaging();
         if ($private) {
             $count = $private->getUnreadCount($this->me->userid);
             $this->inboxCount = $count ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $count) : JText::_('COM_KUNENA_PMS_INBOX');
             $this->pm_link = $private->getInboxURL();
         }
         // Display announcements.
         if ($this->me->isModerator()) {
             $this->announcementsUrl = KunenaForumAnnouncementHelper::getUrl('list');
         }
     }
     return true;
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:35,代码来源:display.php


示例19: getCategories

 /**
  * Get categories for a specific user.
  *
  * @param bool|array|int	$ids		The category ids to load.
  * @param mixed				$user		The user id to load.
  *
  * @return KunenaForumCategoryUser[]
  */
 public static function getCategories($ids = false, $user = null)
 {
     $user = KunenaUserHelper::get($user);
     if ($ids === false) {
         // Get categories which are seen by current user
         $ids = KunenaForumCategoryHelper::getCategories();
     } elseif (!is_array($ids)) {
         $ids = array($ids);
     }
     // Convert category objects into ids
     foreach ($ids as $i => $id) {
         if ($id instanceof KunenaForumCategory) {
             $ids[$i] = $id->id;
         }
     }
     $ids = array_unique($ids);
     self::loadCategories($ids, $user);
     $list = array();
     foreach ($ids as $id) {
         if (!empty(self::$_instances[$user->userid][$id])) {
             $list[$id] = self::$_instances[$user->userid][$id];
         }
     }
     return $list;
 }
开发者ID:sillysachin,项目名称:teamtogether,代码行数:33,代码来源:helper.php


示例20: before

 /**
  * Prepare message actions display.
  *
  * @return void
  */
 protected function before()
 {
     parent::before();
     $catid = $this->input->getInt('id');
     $me = KunenaUserHelper::getMyself();
     $this->category = KunenaForumCategory::getInstance($catid);
     $token = JSession::getFormToken();
     $task = "index.php?option=com_kunena&view=category&task=%s&catid={$catid}&{$token}=1";
     $layout = "index.php?option=com_kunena&view=topic&layout=%s&catid={$catid}";
     $this->template = KunenaFactory::getTemplate();
     $this->categoryButtons = new JObject();
     // Is user allowed to post new topic?
     if ($this->category->getNewTopicCategory()->exists()) {
         $this->categoryButtons->set('create', $this->getButton(sprintf($layout, 'create'), 'create', 'topic', 'communication', true));
     }
     // Is user allowed to mark forums as read?
     if ($me->exists()) {
         $this->categoryButtons->set('markread', $this->getButton(sprintf($task, 'markread'), 'markread', 'category', 'user', true));
     }
     // Is user allowed to subscribe category?
     if ($this->category->isAuthorised('subscribe')) {
         $subscribed = $this->category->getSubscribed($me->userid);
         if (!$subscribed) {
             $this->categoryButtons->set('subscribe', $this->getButton(sprintf($task, 'subscribe'), 'subscribe', 'category', 'user', true));
         } else {
             $this->categoryButtons->set('unsubscribe', $this->getButton(sprintf($task, 'unsubscribe'), 'unsubscribe', 'category', 'user', true));
         }
     }
     JPluginHelper::importPlugin('kunena');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onKunenaGetButtons', array('category.action', $this->categoryButtons, $this));
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:37,代码来源:display.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP KunenaVersion类代码示例发布时间:2022-05-23
下一篇:
PHP KunenaUserBan类代码示例发布时间: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