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

PHP KunenaAccess类代码示例

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

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



在下文中一共展示了KunenaAccess类的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: 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: 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


示例4: getInstance

	public static function getInstance() {
		KUNENA_PROFILER ? KunenaProfiler::instance()->start('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
		if (!self::$instance) {
			self::$instance = new KunenaAccess();
		}
		KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
		return self::$instance;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:8,代码来源:access.php


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


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

 public function getListmodcats()
 {
     $user = $this->getUser();
     $modCatList = array_keys(KunenaAccess::getInstance()->getModeratorStatus($user));
     if (empty($modCatList)) {
         $modCatList[] = 0;
     }
     $categoryList = array();
     if ($this->me->isAdmin()) {
         $categoryList[] = JHtml::_('select.option', 0, JText::_('COM_KUNENA_GLOBAL_MODERATOR'));
     }
     $params = array('sections' => false, 'action' => 'read');
     $modCats = JHtml::_('kunenaforum.categorylist', 'catid[]', 0, $categoryList, $params, 'class="inputbox" multiple="multiple" size="15"', 'value', 'text', $modCatList, 'kforums');
     return $modCats;
 }
开发者ID:sillysachin,项目名称:teamtogether,代码行数:15,代码来源:user.php


示例13: getType

 /**
  * @param int  $catid
  * @param bool|string $code
  *
  * @return string
  */
 public function getType($catid = 0, $code = false)
 {
     static $types = array('admin' => 'COM_KUNENA_VIEW_ADMIN', 'globalmod' => 'COM_KUNENA_VIEW_GLOBAL_MODERATOR', 'moderator' => 'COM_KUNENA_VIEW_MODERATOR', 'user' => 'COM_KUNENA_VIEW_USER', 'guest' => 'COM_KUNENA_VIEW_VISITOR', 'banned' => 'COM_KUNENA_VIEW_BANNED', 'blocked' => 'COM_KUNENA_VIEW_BANNED');
     $moderatedCategories = KunenaAccess::getInstance()->getModeratorStatus($this);
     if (!$this->_type) {
         if ($this->userid == 0) {
             $this->_type = 'guest';
         } elseif ($this->isBanned()) {
             $this->_type = 'banned';
         } elseif ($this->isAdmin(KunenaForumCategoryHelper::get($catid))) {
             $this->_type = 'admin';
         } elseif ($this->isModerator(null)) {
             $this->_type = 'globalmod';
         } elseif (!$catid && !empty($moderatedCategories)) {
             $this->_type = 'moderator';
         } elseif ($catid && isset($moderatedCategories[$catid])) {
             $this->_type = 'moderator';
         } else {
             $this->_type = 'user';
         }
         $userClasses = KunenaFactory::getTemplate()->getUserClasses();
         $this->_class = isset($userClasses[$this->_type]) ? $userClasses[$this->_type] : $userClasses[0] . $this->_type;
     }
     return $code == 'class' ? $this->_class : ($code == false ? $types[$this->_type] : $this->_type);
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:31,代码来源:user.php


示例14:

?>
						<label id="childforums-lbl">
							<input type="checkbox" name="childforums" value="1" <?php 
if ($this->state->get('query.childforums')) {
    echo 'checked="checked"';
}
?>
 />
							<span onclick="document.searchform.childforums.checked=(! document.searchform.childforums.checked);"><?php 
echo JText::_('COM_KUNENA_SEARCH_SEARCHIN_CHILDREN');
?>
</span>
						</label>
					</fieldset>
					<?php 
if (KunenaAccess::getInstance()->getModeratorStatus()) {
    ?>
					<fieldset class="fieldset">
						<legend><?php 
    echo JText::_('COM_KUNENA_SEARCH_SHOW');
    ?>
</legend>
						<input id="show0" type="radio" name="show" value="0" <?php 
    if ($this->state->get('query.show') == 0) {
        echo 'checked="checked"';
    }
    ?>
 />
						<label for="show0"><?php 
    echo JText::_('COM_KUNENA_SEARCH_SHOW_NORMAL');
    ?>
开发者ID:laiello,项目名称:senluonirvana,代码行数:31,代码来源:default.php


示例15: getSubscribers

 /**
  * Get a list of subscribers for a thread
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getSubscribers($message)
 {
     $config = KunenaFactory::getConfig();
     if ($message->hold > 1) {
         return false;
     } elseif ($message->hold == 1) {
         $mailsubs = 0;
         $mailmods = $config->mailmod >= 0;
         $mailadmins = $config->mailadmin >= 0;
     } else {
         $mailsubs = (bool) $config->allowsubscriptions;
         $mailmods = $config->mailmod >= 1;
         $mailadmins = $config->mailadmin >= 1;
     }
     $once = false;
     if ($mailsubs) {
         if (!$message->parent) {
             // New topic: Send email only to category subscribers
             $mailsubs = $config->category_subscriptions != 'disabled' ? KunenaAccess::CATEGORY_SUBSCRIPTION : 0;
             $once = $config->category_subscriptions == 'topic';
         } elseif ($config->category_subscriptions != 'post') {
             // Existing topic: Send email only to topic subscribers
             $mailsubs = $config->topic_subscriptions != 'disabled' ? KunenaAccess::TOPIC_SUBSCRIPTION : 0;
             $once = $config->topic_subscriptions == 'first';
         } else {
             // Existing topic: Send email to both category and topic subscribers
             $mailsubs = $config->topic_subscriptions == 'disabled' ? KunenaAccess::CATEGORY_SUBSCRIPTION : KunenaAccess::CATEGORY_SUBSCRIPTION | KunenaAccess::TOPIC_SUBSCRIPTION;
             // FIXME: category subcription can override topic
             $once = $config->topic_subscriptions == 'first';
         }
     }
     //get all subscribers, moderators and admins who will get the email
     $me = KunenaUserHelper::get();
     $acl = KunenaAccess::getInstance();
     $subscribers = $acl->getSubscribers($message->catid, $message->thread, $mailsubs, $mailmods, $mailadmins, $me->userid);
     if (!$subscribers) {
         return false;
     }
     $result = array();
     foreach ($subscribers as $subscriber) {
         if ($subscriber->id) {
             $result[] = $subscriber->id;
         }
     }
     return $result;
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:54,代码来源:activity.php


示例16: _common

 /**
  * @param   array $userlist
  * @param   array $postlist
  */
 protected function _common(array $userlist = array(), array $postlist = array())
 {
     if ($this->total > 0) {
         // collect user ids for avatar prefetch when integrated
         $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 ($postlist || $lastreadlist || $this->me->userid && ($this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus())) {
             KunenaForumMessageHelper::loadLocation($postlist + $lastpostlist + $lastreadlist);
         }
     }
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:27,代码来源:topics.php


示例17: displayCommon

 /**
  * @param null $tpl
  *
  * @throws Exception
  */
 protected function displayCommon($tpl = null)
 {
     $userid = JFactory::getApplication()->input->getInt('userid');
     $this->_db = JFactory::getDBO();
     $this->do = JFactory::getApplication()->input->getWord('layout');
     if (!$userid) {
         $this->user = JFactory::getUser();
     } else {
         $this->user = JFactory::getUser($userid);
     }
     if ($this->user->id == 0 || $this->me->userid == 0 && !$this->config->pubprofile) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_PROFILEPAGE_NOT_ALLOWED_FOR_GUESTS'), 'notice');
         return;
     }
     $integration = KunenaFactory::getProfile();
     $activityIntegration = KunenaFactory::getActivityIntegration();
     $template = KunenaFactory::getTemplate();
     $this->params = $template->params;
     if (get_class($integration) == 'KunenaProfileNone') {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_PROFILE_DISABLED'), 'notice');
         return;
     }
     $this->allow = true;
     $this->profile = KunenaFactory::getUser($this->user->id);
     if (!$this->profile->exists()) {
         $this->profile->save();
     }
     if ($this->profile->userid == $this->me->userid) {
         if ($this->do != 'edit') {
             $this->editlink = $this->profile->getLink(JText::_('COM_KUNENA_EDIT') . ' &raquo;', JText::_('COM_KUNENA_EDIT') . ' &raquo;', 'nofollow', 'edit', '');
         } else {
             $this->editlink = $this->profile->getLink(JText::_('COM_KUNENA_BACK') . ' &raquo;', JText::_('COM_KUNENA_BACK') . ' &raquo;', 'nofollow', '', '');
         }
     }
     $this->name = $this->user->username;
     if ($this->config->showuserstats) {
         $this->rank_image = $this->profile->getRank(0, 'image');
         $this->rank_title = $this->profile->getRank(0, 'title');
         $this->posts = $this->profile->posts;
         $this->thankyou = $this->profile->thankyou;
         $this->userpoints = $activityIntegration->getUserPoints($this->profile->userid);
         $this->usermedals = $activityIntegration->getUserMedals($this->profile->userid);
     }
     if ($this->config->userlist_joindate || $this->me->isModerator()) {
         $this->registerdate = $this->user->registerDate;
     }
     if ($this->config->userlist_lastvisitdate || $this->me->isModerator()) {
         $this->lastvisitdate = $this->user->lastvisitDate;
     }
     if (!isset($this->lastvisitdate) || $this->lastvisitdate == "0000-00-00 00:00:00") {
         $this->lastvisitdate = null;
     }
     $this->avatarlink = $this->profile->getAvatarImage('kavatar', 'profile');
     $this->personalText = $this->profile->personalText;
     $this->signature = $this->profile->signature;
     $this->signatureHtml = KunenaHtmlParser::parseBBCode($this->signature, null, $this->config->maxsig);
     $this->localtime = KunenaDate::getInstance('now', $this->user->getParam('timezone', $this->app->get('offset', null)));
     try {
         $offset = new DateTimeZone($this->user->getParam('timezone', $this->app->get('offset', null)));
     } catch (Exception $e) {
         $offset = null;
     }
     $this->localtime->setTimezone($offset);
     $this->moderator = KunenaAccess::getInstance()->getModeratorStatus($this->profile);
     $this->admin = $this->profile->isAdmin();
     switch ($this->profile->gender) {
         case 1:
             $this->genderclass = 'male';
             $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_MALE');
             break;
         case 2:
             $this->genderclass = 'female';
             $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_FEMALE');
             break;
         default:
             $this->genderclass = 'unknown';
             $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_UNKNOWN');
     }
     if ($this->profile->location) {
         $this->locationlink = '<a href="http://maps.google.com?q=' . $this->escape($this->profile->location) . '" target="_blank">' . $this->escape($this->profile->location) . '</a>';
     } else {
         $this->locationlink = JText::_('COM_KUNENA_LOCATION_UNKNOWN');
     }
     $this->online = $this->profile->isOnline();
     $this->showUnusedSocial = true;
     if (!preg_match("~^(?:f|ht)tps?://~i", $this->profile->websiteurl)) {
         $this->websiteurl = 'http://' . $this->profile->websiteurl;
     } else {
         $this->websiteurl = $this->profile->websiteurl;
     }
     $avatar = KunenaFactory::getAvatarIntegration();
     $this->editavatar = $avatar instanceof KunenaAvatarKunena ? true : false;
     $this->banInfo = KunenaUserBan::getInstanceByUserid($userid, true);
     $this->canBan = $this->banInfo->canBan();
     if ($this->config->showbannedreason) {
//.........这里部分代码省略.........
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:101,代码来源:view.html.php


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


示例19: getType

 /**
  * Get users type as a string inside the specified category.
  *
  * @param int  $catid   Category id or 0 for global.
  * @param bool $code    True if we want to return the code, otherwise return translation key.
  *
  * @return string
  */
 public function getType($catid = 0, $code = false)
 {
     static $types = array('admin' => 'COM_KUNENA_VIEW_ADMIN', 'localadmin' => 'COM_KUNENA_VIEW_ADMIN', 'globalmod' => 'COM_KUNENA_VIEW_GLOBAL_MODERATOR', 'moderator' => 'COM_KUNENA_VIEW_MODERATOR', 'user' => 'COM_KUNENA_VIEW_USER', 'guest' => 'COM_KUNENA_VIEW_VISITOR', 'banned' => 'COM_KUNENA_VIEW_BANNED', 'blocked' => 'COM_KUNENA_VIEW_BLOCKED');
     $adminCategories = KunenaAccess::getInstance()->getAdminStatus($this);
     $moderatedCategories = KunenaAccess::getInstance()->getModeratorStatus($this);
     if ($this->userid == 0) {
         $type = 'guest';
     } elseif ($this->isBlocked()) {
         $type = 'blocked';
     } elseif ($this->isBanned()) {
         $type = 'banned';
     } elseif (!empty($adminCategories[0])) {
         $type = 'admin';
     } elseif (!empty($adminCategories[$catid])) {
         $type = 'localadmin';
     } elseif (!empty($moderatedCategories[0])) {
         $type = 'globalmod';
     } elseif (!empty($moderatedCategories[$catid])) {
         $type = 'moderator';
     } elseif (!$catid && !empty($moderatedCategories)) {
         $type = 'moderator';
     } else {
         $type = 'user';
     }
     // Deprecated in K4.0
     if ($code === 'class') {
         $userClasses = KunenaFactory::getTemplate()->getUserClasses();
         return isset($userClasses[$type]) ? $userClasses[$type] : $userClasses[0] . $type;
     }
     return $code ? $type : $types[$type];
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:39,代码来源:user.php


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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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