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


PHP KunenaForumMessageHelper类代码示例

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


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

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

示例2: before

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

		$userid = $this->input->getInt('userid');
		$params = array('file' => '1', 'image' => '1', 'orderby' => 'desc', 'limit' => '30');

		$this->template = KunenaFactory::getTemplate();
		$this->me = KunenaUserHelper::getMyself();
		$this->profile = KunenaUserHelper::get($userid);
		$this->attachments = KunenaAttachmentHelper::getByUserid($this->profile, $params);

		// Pre-load messages.
		$messageIds = array();

		foreach ($this->attachments as $attachment)
		{
			$messageIds[] = (int) $attachment->mesid;
		}

		$messages = KunenaForumMessageHelper::getMessages($messageIds, 'none');

		// Pre-load topics.
		$topicIds = array();

		foreach ($messages as $message)
		{
			$topicIds[] = $message->thread;
		}

		KunenaForumTopicHelper::getTopics($topicIds, 'none');

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

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

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

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

示例6: getPosts

 /**
  * @param  UserTable    $viewer  Viewing User
  * @param  UserTable    $user    Viewed at User
  * @param  TabTable     $tab     Current Tab
  * @param  PluginTable  $plugin  Current Plugin
  * @return string                HTML
  */
 public static function getPosts($viewer, $user, $tab, $plugin)
 {
     global $_CB_framework, $_CB_database;
     if (!class_exists('KunenaForumMessageHelper')) {
         return CBTxt::T('Kunena not installed, enabled, or failed to load.');
     }
     $exclude = $plugin->params->get('forum_exclude', null);
     if ($exclude) {
         $exclude = explode('|*|', $exclude);
         cbArrayToInts($exclude);
         $exclude = implode(',', $exclude);
     }
     cbimport('cb.pagination');
     cbforumsClass::getTemplate('tab_posts');
     $limit = (int) $tab->params->get('tab_posts_limit', 15);
     $limitstart = $_CB_framework->getUserStateFromRequest('tab_posts_limitstart{com_comprofiler}', 'tab_posts_limitstart');
     $filterSearch = $_CB_framework->getUserStateFromRequest('tab_posts_search{com_comprofiler}', 'tab_posts_search');
     $where = array();
     if (isset($filterSearch) && $filterSearch != '') {
         $where[] = '( m.' . $_CB_database->NameQuote('subject') . ' LIKE ' . $_CB_database->Quote('%' . $_CB_database->getEscaped($filterSearch, true) . '%', false) . ' OR t.' . $_CB_database->NameQuote('message') . ' LIKE ' . $_CB_database->Quote('%' . $_CB_database->getEscaped($filterSearch, true) . '%', false) . ' )';
     }
     $searching = count($where) ? true : false;
     if ($exclude) {
         $where[] = '( m.' . $_CB_database->NameQuote('catid') . ' NOT IN ( ' . $exclude . ' ) )';
     }
     $params = array('user' => (int) $user->id, 'starttime' => -1, 'where' => count($where) ? implode(' AND ', $where) : null);
     $posts = KunenaForumMessageHelper::getLatestMessages(false, 0, 0, $params);
     $total = array_shift($posts);
     if ($total <= $limitstart) {
         $limitstart = 0;
     }
     $pageNav = new cbPageNav($total, $limitstart, $limit);
     $pageNav->setInputNamePrefix('tab_posts_');
     if ($tab->params->get('tab_posts_paging', 1)) {
         $posts = KunenaForumMessageHelper::getLatestMessages(false, (int) $pageNav->limitstart, (int) $pageNav->limit, $params);
         $posts = array_pop($posts);
     } else {
         $posts = array_pop($posts);
     }
     $rows = array();
     /** @var KunenaForumMessage[] $posts */
     if ($posts) {
         foreach ($posts as $post) {
             $row = new stdClass();
             $row->id = $post->id;
             $row->subject = $post->subject;
             $row->message = $post->message;
             $row->date = $post->time;
             $row->url = $post->getUrl();
             $row->category_id = $post->getCategory()->id;
             $row->category_name = $post->getCategory()->name;
             $row->category_url = $post->getCategory()->getUrl();
             $rows[] = $row;
         }
     }
     $input = array();
     $input['search'] = '<input type="text" name="tab_posts_search" value="' . htmlspecialchars($filterSearch) . '" onchange="document.forumPostsForm.submit();" placeholder="' . htmlspecialchars(CBTxt::T('Search Posts...')) . '" class="form-control" />';
     return HTML_cbforumsTabPosts::showPosts($rows, $pageNav, $searching, $input, $viewer, $user, $tab, $plugin);
 }
开发者ID:bobozhangshao,项目名称:HeartCare,代码行数:66,代码来源:kunena20.php

示例7: before

 /**
  * Prepare topic reply form.
  *
  * @return void
  *
  * @throws RuntimeException
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $catid = $this->input->getInt('catid');
     $id = $this->input->getInt('id');
     $mesid = $this->input->getInt('mesid');
     $quote = $this->input->getBool('quote', false);
     $saved = $this->app->getUserState('com_kunena.postfields');
     $this->me = KunenaUserHelper::getMyself();
     $this->template = KunenaFactory::getTemplate();
     if (!$mesid) {
         $this->topic = KunenaForumTopicHelper::get($id);
         $parent = KunenaForumMessageHelper::get($this->topic->first_post_id);
     } else {
         $parent = KunenaForumMessageHelper::get($mesid);
         $this->topic = $parent->getTopic();
     }
     $this->category = $this->topic->getCategory();
     if ($parent->isAuthorised('reply') && $this->me->canDoCaptcha()) {
         if (JPluginHelper::isEnabled('captcha')) {
             $plugin = JPluginHelper::getPlugin('captcha');
             $params = new JRegistry($plugin[0]->params);
             $captcha_pubkey = $params->get('public_key');
             $catcha_privkey = $params->get('private_key');
             if (!empty($captcha_pubkey) && !empty($catcha_privkey)) {
                 JPluginHelper::importPlugin('captcha');
                 $dispatcher = JDispatcher::getInstance();
                 $result = $dispatcher->trigger('onInit', 'dynamic_recaptcha_1');
                 $this->captchaEnabled = $result[0];
             }
         } else {
             $this->captchaEnabled = false;
         }
     }
     $parent->tryAuthorise('reply');
     // Run event.
     $params = new JRegistry();
     $params->set('ksource', 'kunena');
     $params->set('kunena_view', 'topic');
     $params->set('kunena_layout', 'reply');
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('kunena');
     $dispatcher->trigger('onKunenaPrepare', array('kunena.topic', &$this->topic, &$params, 0));
     // Can user edit topic icons?
     if ($this->config->topicicons && $this->topic->isAuthorised('edit')) {
         $this->topicIcons = $this->template->getTopicIcons(false, $saved ? $saved['icon_id'] : $this->topic->icon_id);
     }
     list($this->topic, $this->message) = $parent->newReply($saved ? $saved : $quote);
     $this->action = 'post';
     $this->allowedExtensions = KunenaAttachmentHelper::getExtensions($this->category);
     $this->post_anonymous = $saved ? $saved['anonymous'] : !empty($this->category->post_anonymous);
     $this->subscriptionschecked = $saved ? $saved['subscribe'] : $this->config->subscriptionschecked == 1;
     $this->app->setUserState('com_kunena.postfields', null);
     $this->canSubscribe = $this->canSubscribe();
     $this->headerText = JText::_('COM_KUNENA_BUTTON_MESSAGE_REPLY') . ' ' . $this->topic->subject;
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:64,代码来源:display.php

示例8: getForum

	static public function getForum( $tabs, $row, $user, $plugin ) {
		global $_CB_database;

		if ( ! class_exists( 'KunenaForumMessageHelper' ) ) {
			return CBTxt::T( 'Kunena not installed, enabled, or failed to load.' );
		}

		$params				=	$row->getParams();
		$forumId			=	$params->get( 'forum_id', null );

		cbgjClass::getTemplate( 'cbgroupjiveforums' );

		$paging				=	new cbgjPaging( 'forum' );

		$limit				=	$paging->getlimit( (int) $plugin->params->get( 'forum_limit', 15 ) );
		$limitstart			=	$paging->getLimistart();
		$search				=	$paging->getFilter( 'search' );
		$where				=	array();

		if ( isset( $search ) && ( $search != '' ) ) {
			$where[]		=	'( m.' . $_CB_database->NameQuote( 'subject' ) . ' LIKE ' . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
							.	' OR t.' . $_CB_database->NameQuote( 'message' ) . ' LIKE ' . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false ) . ' )';
		}

		$params				=	array(	'starttime' => -1,
										'where' => ( count( $where ) ? implode( ' AND ', $where ) : null )
									);

		$rows				=	KunenaForumMessageHelper::getLatestMessages( $forumId, 0, 0, $params );
		$total				=	array_shift( $rows );

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

		$pageNav			=	$paging->getPageNav( $total, $limitstart, $limit );

		if ( $plugin->params->get( 'forum_paging', 1 ) ) {
			$rows			=	KunenaForumMessageHelper::getLatestMessages( $forumId, (int) $pageNav->limitstart, (int) $pageNav->limit, $params );
			$rows			=	array_pop( $rows );
		} else {
			$rows			=	array_pop( $rows );
		}

		$pageNav->search	=	$paging->getInputSearch( 'gjForm_forum', 'search', CBTxt::T( 'Search Forums...' ), $search );
		$pageNav->searching	=	( $search ? true : false );
		$pageNav->limitbox	=	$paging->getLimitbox( $pageNav );
		$pageNav->pagelinks	=	$paging->getPagesLinks( $pageNav );

		if ( class_exists( 'HTML_cbgroupjiveforums' ) ) {
			return HTML_cbgroupjiveforums::showForums( $rows, $pageNav, $tabs, $row, $user, $plugin );
		} else {
			return cbgjForumsPlugin::showForum( $rows, $pageNav, $tabs, $row, $user, $plugin );
		}
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:55,代码来源:kunena20.php

示例9: before

 /**
  * Redirect unread layout to the page that contains the first unread message.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     $catid = $this->input->getInt('catid', 0);
     $id = $this->input->getInt('id', 0);
     $category = KunenaForumCategoryHelper::get($catid);
     $category->tryAuthorise();
     $topic = KunenaForumTopicHelper::get($id);
     $topic->tryAuthorise();
     KunenaForumTopicHelper::fetchNewStatus(array($topic->id => $topic));
     $message = KunenaForumMessageHelper::get($topic->lastread ? $topic->lastread : $topic->last_post_id);
     $message->tryAuthorise();
     while (@ob_end_clean()) {
     }
     $this->app->redirect($topic->getUrl($category, false, $message));
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:22,代码来源:display.php

示例10: before

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

示例11: before

 /**
  * Prepare category subscriptions display.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $me = KunenaUserHelper::getMyself();
     if (!$me->exists()) {
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 401);
     }
     $limit = $this->input->getInt('limit', 0);
     if ($limit < 1 || $limit > 100) {
         $limit = 20;
     }
     $limitstart = $this->input->getInt('limitstart', 0);
     if ($limitstart < 0) {
         $limitstart = 0;
     }
     list($total, $this->categories) = KunenaForumCategoryHelper::getLatestSubscriptions($me->userid);
     $topicIds = array();
     $userIds = array();
     $postIds = array();
     foreach ($this->categories as $category) {
         // Get list of topics.
         if ($category->last_topic_id) {
             $topicIds[$category->last_topic_id] = $category->last_topic_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.
     if ($me->exists() && !$me->isBanned()) {
         // Load new topic counts.
         KunenaForumCategoryHelper::getNewTopics(array_keys($this->categories));
     }
     $this->actions = $this->getActions();
     $this->pagination = new JPagination($total, $limitstart, $limit);
     $this->headerText = JText::_('COM_KUNENA_CATEGORY_SUBSCRIPTIONS');
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:50,代码来源:display.php

示例12: _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

示例13: getMessages

 public function getMessages()
 {
     if ($this->messages === false) {
         $layout = $this->getState('layout');
         $threaded = $layout == 'indented' || $layout == 'threaded';
         $this->messages = KunenaForumMessageHelper::getMessagesByTopic($this->getState('item.id'), $this->getState('list.start'), $this->getState('list.limit'), $this->getState('list.direction'), $this->getState('hold'), $threaded);
         // Get thankyous for all messages in the page
         $thankyous = KunenaForumMessageThankyouHelper::getByMessage($this->messages);
         // First collect ids and users
         $userlist = array();
         $this->threaded = array();
         $location = $this->getState('list.start');
         foreach ($this->messages as $message) {
             $message->replynum = ++$location;
             if ($threaded) {
                 // Threaded ordering
                 if (isset($this->messages[$message->parent])) {
                     $this->threaded[$message->parent][] = $message->id;
                 } else {
                     $this->threaded[0][] = $message->id;
                 }
             }
             $userlist[intval($message->userid)] = intval($message->userid);
             $userlist[intval($message->modified_by)] = intval($message->modified_by);
             $thankyou_list = $thankyous[$message->id]->getList();
             $message->thankyou = array();
             if (!empty($thankyou_list)) {
                 $message->thankyou = $thankyou_list;
             }
         }
         if (!isset($this->messages[$this->getState('item.mesid')]) && !empty($this->messages)) {
             $this->setState('item.mesid', reset($this->messages)->id);
         }
         if ($threaded) {
             if (!isset($this->messages[$this->topic->first_post_id])) {
                 $this->messages = $this->getThreadedOrdering(0, array('edge'));
             } else {
                 $this->messages = $this->getThreadedOrdering();
             }
         }
         // Prefetch all users/avatars to avoid user by user queries during template iterations
         KunenaUserHelper::loadUsers($userlist);
         // Get attachments
         KunenaForumMessageAttachmentHelper::getByMessage($this->messages);
     }
     return $this->messages;
 }
开发者ID:sillysachin,项目名称:teamtogether,代码行数:47,代码来源:topic.php

示例14: before

 /**
  * Prepare displaying message.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $mesid = $this->input->getInt('mesid', 0);
     $this->me = KunenaUserHelper::getMyself();
     $this->location = $this->input->getInt('location', 0);
     $this->detail = $this->input->get('detail', false);
     $this->message = KunenaForumMessageHelper::get($mesid);
     $this->message->tryAuthorise();
     $this->topic = $this->message->getTopic();
     $this->category = $this->topic->getCategory();
     $this->profile = $this->message->getAuthor();
     $this->ktemplate = KunenaFactory::getTemplate();
     $this->captchaEnabled = false;
     if ($this->message->isAuthorised('reply') && $this->me->canDoCaptcha()) {
         if (JPluginHelper::isEnabled('captcha')) {
             $plugin = JPluginHelper::getPlugin('captcha');
             $params = new JRegistry($plugin[0]->params);
             $captcha_pubkey = $params->get('public_key');
             $catcha_privkey = $params->get('private_key');
             if (!empty($captcha_pubkey) && !empty($catcha_privkey)) {
                 JPluginHelper::importPlugin('captcha');
                 $dispatcher = JDispatcher::getInstance();
                 $result = $dispatcher->trigger('onInit', "dynamic_recaptcha_{$this->message->id}");
                 $this->captchaEnabled = $result[0];
             }
         }
     }
     // Thank you info and buttons.
     $this->thankyou = array();
     $this->total_thankyou = 0;
     $this->more_thankyou = 0;
     $this->thankyou_delete = array();
     if (isset($this->message->thankyou)) {
         if ($this->config->showthankyou && $this->profile->exists()) {
             $task = "index.php?option=com_kunena&view=topic&task=%s&catid={$this->category->id}" . "&id={$this->topic->id}&mesid={$this->message->id}&" . JSession::getFormToken() . '=1';
             // Ror normal users, show only limited number of thankyou (config->thankyou_max).
             if (!$this->me->isAdmin() && !$this->me->isModerator()) {
                 if (count($this->message->thankyou) > $this->config->thankyou_max) {
                     $this->more_thankyou = count($this->message->thankyou) - $this->config->thankyou_max;
                 }
                 $this->total_thankyou = count($this->message->thankyou);
                 $thankyous = array_slice($this->message->thankyou, 0, $this->config->thankyou_max, true);
             } else {
                 $thankyous = $this->message->thankyou;
             }
             $userids_thankyous = array();
             foreach ($thankyous as $userid => $time) {
                 $userids_thankyous[] = $userid;
             }
             $loaded_users = KunenaUserHelper::loadUsers($userids_thankyous);
             foreach ($loaded_users as $userid => $user) {
                 if ($this->message->authorise('unthankyou') && $this->me->isModerator($this->message->getCategory())) {
                     $this->thankyou_delete[$userid] = KunenaRoute::_(sprintf($task, "unthankyou&userid={$userid}"));
                 }
                 $this->thankyou[$userid] = $loaded_users[$userid]->getLink();
             }
         }
     }
     if ($this->config->reportmsg && $this->me->exists()) {
         if ($this->config->user_report && $this->me->userid == $this->message->userid && !$this->me->isModerator()) {
             $this->reportMessageLink = JHTML::_('kunenaforum.link', 'index.php?option=com_kunena&view=topic&layout=report&catid=' . intval($this->category->id) . '&id=' . intval($this->message->thread) . '&mesid=' . intval($this->message->id), JText::_('COM_KUNENA_REPORT'), JText::_('COM_KUNENA_REPORT'));
         }
     }
     // Show admins the IP address of the user.
     if ($this->category->isAuthorised('admin') || $this->category->isAuthorised('moderate') && !$this->config->hide_ip) {
         if (!empty($this->message->ip)) {
             $this->ipLink = '<a href="http://whois.domaintools.com/' . $this->message->ip . '" target="_blank"> IP: ' . $this->message->ip . '</a>';
         } else {
             $this->ipLink = '&nbsp;';
         }
     }
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:80,代码来源:display.php

示例15: ban


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


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