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


PHP KunenaAccess::getInstance方法代码示例

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


在下文中一共展示了KunenaAccess::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: displayDefault

	function displayDefault($tpl = null)
	{
		$this->message_ordering = $this->me->getMessageOrdering();
		//TODO: Need to move the select markup outside of view.  Otherwise difficult to stylize

		$this->searchwords = $this->get('SearchWords');
		$this->isModerator = ($this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus($this->me));

		$this->results = array();
		$this->total   = $this->get('Total');

		if ($this->total)
		{
			$this->results      = $this->get('Results');
			$this->search_class = ' open';
			$this->search_style = ' style="display: none;"';
			$this->search_title = JText::_('COM_KUNENA_TOGGLER_EXPAND');
		}
		else
		{
			$this->search_class = ' close';
			$this->search_style = '';
			$this->search_title = JText::_('COM_KUNENA_TOGGLER_COLLAPSE');
		}

		$this->selected = ' selected="selected"';
		$this->checked  = ' checked="checked"';
		$this->error    = $this->get('Error');

		$this->_prepareDocument();

		$this->render('Search', $tpl);
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:33,代码来源:view.html.php

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

示例4: onAfterReply

 public function onAfterReply($message)
 {
     if (JString::strlen($message->message) > $this->params->get('activity_points_limit', 0)) {
         CFactory::load('libraries', 'userpoints');
         CUserPoints::assignPoint('com_kunena.thread.reply');
     }
     // Get users who have subscribed to the topic, excluding current user.
     $acl = KunenaAccess::getInstance();
     $subscribers = $acl->getSubscribers($message->catid, $message->thread, KunenaAccess::TOPIC_SUBSCRIPTION, false, false, array($message->userid));
     foreach ($subscribers as $userid) {
         $actor = CFactory::getUser($message->userid);
         $target = CFactory::getUser($userid);
         $params = new CParameter('');
         $params->set('actorName', $actor->getDisplayName());
         $params->set('recipientName', $target->getDisplayName());
         $params->set('url', JUri::getInstance()->toString(array('scheme', 'host', 'port')) . $message->getPermaUrl(null));
         // {url} tag for activity. Used when hovering over avatar in notification window, as well as in email notification
         $params->set('title', $message->displayField('subject'));
         // (title) tag in language file
         $params->set('title_url', $message->getPermaUrl());
         // Make the title in notification - linkable
         $params->set('message', $message->displayField('message'));
         // (message) tag in language file
         $params->set('actor', $actor->getDisplayName());
         // Actor in the stream
         $params->set('actor_url', 'index.php?option=com_community&view=profile&userid=' . $actor->id);
         // Actor Link
         // Finally, send notifications
         CNotificationLibrary::add('kunena_reply', $actor->id, $target->id, JText::sprintf('PLG_KUNENA_COMMUNITY_ACTIVITY_REPLY_TITLE_ACT'), JText::sprintf('PLG_KUNENA_COMMUNITY_ACTIVITY_REPLY_TEXT'), '', $params);
     }
     /* Activity stream */
     $act = new stdClass();
     $act->cmd = 'wall.write';
     $act->actor = $message->userid;
     $act->target = 0;
     // no target
     $act->title = JText::_('{single}{actor}{/single}{multiple}{actors}{/multiple} ' . JText::sprintf('PLG_KUNENA_COMMUNITY_ACTIVITY_REPLY_TITLE', '<a href="' . $message->getTopic()->getUrl() . '">' . $message->subject . '</a>'));
     $act->content = $this->buildContent($message);
     $act->app = 'kunena.thread.reply';
     $act->cid = $message->thread;
     $act->access = $this->getAccess($message->getCategory());
     // Comments and like support
     $act->comment_id = $message->thread;
     $act->comment_type = 'kunena.thread.reply';
     $act->like_id = $message->thread;
     $act->like_type = 'kunena.thread.reply';
     // Do not add private activities
     if ($act->access > 20) {
         return;
     }
     CFactory::load('libraries', 'activities');
     $table = CActivityStream::add($act);
     if (is_object($table)) {
         $table->like_id = $table->id;
         $table->store();
     }
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:57,代码来源:activity.php

示例5: __construct

 public function __construct()
 {
     $this->integration = KunenaIntegration::getInstance('communitybuilder');
     if (!$this->integration || !$this->integration->isLoaded()) {
         return;
     }
     $this->joomlaAccess = KunenaAccess::getInstance('joomla');
     $this->priority = 50;
 }
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:9,代码来源:access.php

示例6: before

 /**
  * Prepare search form 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->isModerator = $this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus();
     $this->error = $this->model->getError();
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:16,代码来源:display.php

示例7: displaySubscriptions

 function displaySubscriptions()
 {
     $id = $this->app->input->get('id', 0, 'int');
     $topic = KunenaForumTopicHelper::get($id);
     $acl = KunenaAccess::getInstance();
     $cat_subscribers = $acl->loadSubscribers($topic, KunenaAccess::CATEGORY_SUBSCRIPTION);
     $this->cat_subscribers_users = KunenaUserHelper::loadUsers($cat_subscribers);
     $topic_subscribers = $acl->loadSubscribers($topic, KunenaAccess::TOPIC_SUBSCRIPTION);
     $this->topic_subscribers_users = KunenaUserHelper::loadUsers($topic_subscribers);
     $this->cat_topic_subscribers = $acl->getSubscribers($topic->getCategory()->id, $id, KunenaAccess::CATEGORY_SUBSCRIPTION | KunenaAccess::TOPIC_SUBSCRIPTION, 1, 1);
     $this->display();
 }
开发者ID:russelljuwai,项目名称:Kunena-Forum,代码行数:12,代码来源:view.html.php

示例8: populateState

	protected function populateState() {
		$active = $this->app->getMenu ()->getActive ();
		$active = $active ? (int) $active->id : 0;

		$layout = $this->me->getTopicLayout ();
		$this->setState ( 'layout', $layout );

		$template = KunenaFactory::getTemplate();
		$profile_location = $template->params->get('avatarPosition', 'left');
		$profile_direction = $profile_location == 'left' || $profile_location == 'right' ? 'vertical' : 'horizontal';
		$this->setState ( 'profile.location', $profile_location );
		$this->setState ( 'profile.direction', $profile_direction );

		$catid = $this->getInt ( 'catid', 0 );
		$this->setState ( 'item.catid', $catid );

		$id = $this->getInt ( 'id', 0 );
		$this->setState ( 'item.id', $id );

		$id = $this->getInt ( 'mesid', 0 );
		$this->setState ( 'item.mesid', $id );

		$access = KunenaAccess::getInstance();
		$value = $access->getAllowedHold($this->me, $catid);
		$this->setState ( 'hold', $value );

		$value = $this->getInt ( 'limit', 0 );
		if ($value < 1 || $value > 100) $value = $this->config->messages_per_page;
		$this->setState ( 'list.limit', $value );

		//$value = $this->getUserStateFromRequest ( "com_kunena.topic_{$active}_{$layout}_list_ordering", 'filter_order', 'time', 'cmd' );
		//$this->setState ( 'list.ordering', $value );

		$value = $this->getInt ( 'limitstart', 0 );
		if ($value < 0) $value = 0;
		$this->setState ( 'list.start', $value );

		$value = $this->getUserStateFromRequest ( "com_kunena.topic_{$active}_{$layout}_list_direction", 'filter_order_Dir', '', 'word' );
		if (!$value) {
			if ($this->me->ordering != '0') {
				$value = $this->me->ordering == '1' ? 'desc' : 'asc';
			} else {
				$value = $this->config->default_sort == 'asc' ? 'asc' : 'desc';
			}
		}
		if ($value != 'asc')
			$value = 'desc';
		$this->setState ( 'list.direction', $value );
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:49,代码来源:topic.php

示例9: save

 function save()
 {
     $db = JFactory::getDBO();
     if (!JRequest::checkToken()) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
         $this->app->redirect(KunenaRoute::_($this->baseurl, false));
     }
     $newview = JRequest::getVar('newview');
     $newrank = JRequest::getVar('newrank');
     $signature = JRequest::getVar('signature');
     $deleteSig = JRequest::getVar('deleteSig');
     $moderator = JRequest::getInt('moderator');
     $uid = JRequest::getInt('uid');
     $avatar = JRequest::getVar('avatar');
     $deleteAvatar = JRequest::getVar('deleteAvatar');
     $neworder = JRequest::getInt('neworder');
     $modCatids = $moderator ? JRequest::getVar('catid', array()) : array();
     if ($deleteSig == 1) {
         $signature = "";
     }
     $avatar = '';
     if ($deleteAvatar == 1) {
         $avatar = ",avatar=''";
     }
     $db->setQuery("UPDATE #__kunena_users SET signature={$db->quote($signature)}, view='{$newview}', ordering='{$neworder}', rank='{$newrank}' {$avatar} WHERE userid='{$uid}'");
     $db->query();
     if (KunenaError::checkDatabaseError()) {
         return;
     }
     $this->app->enqueueMessage(JText::_('COM_KUNENA_USER_PROFILE_SAVED_SUCCESSFULLY'));
     // Update moderator rights
     $categories = KunenaForumCategoryHelper::getCategories(false, false, 'admin');
     $user = KunenaFactory::getUser($uid);
     foreach ($categories as $category) {
         $category->setModerator($user, in_array($category->id, $modCatids));
     }
     // Global moderator is a special case
     if ($this->me->isAdmin()) {
         KunenaAccess::getInstance()->setModerator(0, $user, in_array(0, $modCatids));
     }
     $this->app->redirect(KunenaRoute::_($this->baseurl, false));
 }
开发者ID:laiello,项目名称:senluonirvana,代码行数:42,代码来源:users.php

示例10: displayForumJump

 function displayForumJump($tpl = null)
 {
     if ($this->offline) {
         return;
     }
     $allowed = md5(serialize(KunenaAccess::getInstance()->getAllowedCategories()));
     $cache = JFactory::getCache('com_kunena', 'output');
     if ($cache->start("{$this->ktemplate->name}.common.jump.{$allowed}", 'com_kunena.template')) {
         return;
     }
     $options = array();
     $options[] = JHtml::_('select.option', '0', JText::_('COM_KUNENA_FORUM_TOP'));
     $cat_params = array('sections' => 1, 'catid' => 0);
     $this->categorylist = JHtml::_('kunenaforum.categorylist', 'catid', 0, $options, $cat_params, 'class="inputbox fbs" size="1" onchange = "this.form.submit()"', 'value', 'text', $this->catid);
     $result = $this->loadTemplateFile($tpl);
     if (JError::isError($result)) {
         return $result;
     }
     echo $result;
     $cache->end();
 }
开发者ID:r-ahmadi,项目名称:Kunena-Forum,代码行数:21,代码来源:view.html.php

示例11: before

 /**
  * Prepare topic list for moderators.
  *
  * @return void
  */
 protected function before()
 {
     parent::before();
     $this->me = KunenaUserHelper::getMyself();
     $access = KunenaAccess::getInstance();
     $this->moreUri = null;
     $params = $this->app->getParams('com_kunena');
     $start = $this->input->getInt('limitstart', 0);
     $limit = $this->input->getInt('limit', 0);
     if ($limit < 1 || $limit > 100) {
         $limit = $this->config->threads_per_page;
     }
     // Get configuration from menu item.
     $categoryIds = $params->get('topics_categories', array());
     $reverse = !$params->get('topics_catselection', 1);
     // Make sure that category list is an array.
     if (!is_array($categoryIds)) {
         $categoryIds = explode(',', $categoryIds);
     }
     if (!$reverse && empty($categoryIds) || in_array(0, $categoryIds)) {
         $categoryIds = false;
     }
     $categories = KunenaForumCategoryHelper::getCategories($categoryIds, $reverse);
     $finder = new KunenaForumTopicFinder();
     $finder->filterByCategories($categories)->filterAnsweredBy(array_keys($access->getModerators() + $access->getAdmins()), true)->filterByMoved(false)->where('locked', '=', 0);
     $this->pagination = new KunenaPagination($finder->count(), $start, $limit);
     if ($this->moreUri) {
         $this->pagination->setUri($this->moreUri);
     }
     $this->topics = $finder->order('last_post_time', -1)->start($this->pagination->limitstart)->limit($this->pagination->limit)->find();
     if ($this->topics) {
         $this->prepareTopics();
     }
     $actions = array('delete', 'approve', 'undelete', 'move', 'permdelete');
     $this->actions = $this->getTopicActions($this->topics, $actions);
     // TODO <-
     $this->headerText = JText::_('Topics Needing Attention');
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:43,代码来源:display.php

示例12: getCategories

 /**
  * @param   bool|array   $ids
  * @param   bool   $reverse
  * @param   string $authorise
  *
  * @return array|KunenaForumCategory[]
  */
 public static function getCategories($ids = false, $reverse = false, $authorise = 'read')
 {
     KUNENA_PROFILER ? KunenaProfiler::instance()->start('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
     if ($ids === false) {
         if ($authorise == 'none') {
             KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
             return self::$_instances;
         }
         $ids = self::$_instances;
     } elseif (is_array($ids)) {
         $ids = array_flip($ids);
     } else {
         $ids = array(intval($ids) => 1);
     }
     if (!$reverse) {
         $allowed = $authorise != 'none' ? array_intersect_key($ids, KunenaAccess::getInstance()->getAllowedCategories()) : $ids;
         $list = array_intersect_key(self::$_instances, $allowed);
         if ($authorise != 'none' && $authorise != 'read') {
             foreach ($list as $category) {
                 // @var KunenaForumCategory $category
                 if (!$category->authorise($authorise, null, true)) {
                     unset($list[$category->id]);
                 }
             }
         }
     } else {
         $allowed = $authorise != 'none' ? array_intersect_key(self::$_instances, KunenaAccess::getInstance()->getAllowedCategories()) : self::$_instances;
         $list = array_diff_key($allowed, $ids);
         if ($authorise != 'none' && $authorise != 'read') {
             foreach ($list as $category) {
                 // @var KunenaForumCategory $category
                 if (!$category->authorise($authorise, null, true)) {
                     unset($list[$category->id]);
                 }
             }
         }
     }
     KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
     return $list;
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:47,代码来源:helper.php

示例13: authoriseRead

 /**
  * @param KunenaUser $user
  *
  * @return KunenaExceptionAuthorise|null
  */
 protected function authoriseRead(KunenaUser $user)
 {
     static $catids = false;
     if ($catids === false) {
         $catids = KunenaAccess::getInstance()->getAllowedCategories($user);
     }
     // Checks if user can read category
     if (!$this->exists()) {
         return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 404);
     }
     if (empty($catids[$this->id])) {
         if ($user->exists()) {
             return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 403);
         } else {
             return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 401);
         }
     }
     return null;
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:24,代码来源:category.php

示例14: getLocation

 /**
  * @param int $mesid
  * @param null|string $direction
  * @param null|array $hold
  *
  * @return int
  */
 public static function getLocation($mesid, $direction = null, $hold = null)
 {
     if (is_null($direction)) {
         $direction = KunenaUserHelper::getMyself()->getMessageOrdering();
     }
     if (!$hold) {
         $me = KunenaUserHelper::getMyself();
         $mes_instance = KunenaForumMessageHelper::get($mesid);
         $hold = KunenaAccess::getInstance()->getAllowedHold($me->userid, $mes_instance->catid, false);
     }
     if (!isset(self::$_location[$mesid])) {
         self::loadLocation(array($mesid));
     }
     $location = self::$_location[$mesid];
     $count = 0;
     foreach ($location->hold as $meshold => $values) {
         if (isset($hold[$meshold])) {
             $count += $values[$direction == 'asc' ? 'before' : 'after'];
             if ($direction == 'both') {
                 $count += $values['before'];
             }
         }
     }
     return $count;
 }
开发者ID:proyectoseb,项目名称:University,代码行数:32,代码来源:helper.php

示例15: authoriseRead

 /**
  * @param KunenaUser $user
  *
  * @return KunenaExceptionAuthorise|null
  */
 protected function authoriseRead(KunenaUser $user)
 {
     // Check that user can read topic
     if (!$this->exists()) {
         return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 404);
     }
     // TODO: Allow owner to see his posts.
     if ($this->hold) {
         if (!$user->exists()) {
             return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 401);
         }
         $access = KunenaAccess::getInstance();
         $hold = $access->getAllowedHold($user->userid, $this->category_id, false);
         if (!in_array($this->hold, $hold)) {
             return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 403);
         }
     }
     return null;
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:24,代码来源:topic.php


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