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


PHP KunenaForumMessageHelper::get方法代码示例

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


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

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

示例2: getTopic

 public function getTopic()
 {
     if ($this->topic === false) {
         $mesid = $this->getState('item.mesid');
         if ($mesid) {
             // Find actual topic by fetching current message
             $message = KunenaForumMessageHelper::get($mesid);
             $topic = KunenaForumTopicHelper::get($message->thread);
             $this->setState('list.start', intval($topic->getPostLocation($mesid) / $this->getState('list.limit')) * $this->getState('list.limit'));
         } else {
             $topic = KunenaForumTopicHelper::get($this->getState('item.id'));
             $ids = array();
             // If topic has been moved, find the new topic
             while ($topic->moved_id) {
                 if (isset($ids[$topic->moved_id])) {
                     // Break on loops
                     return false;
                 }
                 $ids[$topic->moved_id] = 1;
                 $topic = KunenaForumTopicHelper::get($topic->moved_id);
             }
             // If topic doesn't exist, check if there's a message with the same id
             /*if (! $topic->exists()) {
             			$message = KunenaForumMessageHelper::get($this->getState ( 'item.id'));
             			if ($message->exists()) {
             				$topic = KunenaForumTopicHelper::get($message->thread);
             			}
             		}*/
         }
         $this->topic = $topic;
     }
     return $this->topic;
 }
开发者ID:sillysachin,项目名称:teamtogether,代码行数:33,代码来源:topic.php

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

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

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

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

示例7: before

 /**
  * Prepare topic edit form.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $this->catid = $this->input->getInt('catid');
     $mesid = $this->input->getInt('mesid');
     $saved = $this->app->getUserState('com_kunena.postfields');
     $this->me = KunenaUserHelper::getMyself();
     $this->template = KunenaFactory::getTemplate();
     $this->message = KunenaForumMessageHelper::get($mesid);
     $this->message->tryAuthorise('edit');
     $this->topic = $this->message->getTopic();
     $this->category = $this->topic->getCategory();
     $this->template->setCategoryIconset($this->topic->getCategory()->iconset);
     if ($this->config->topicicons && $this->topic->isAuthorised('edit')) {
         $this->topicIcons = $this->template->getTopicIcons(false, $saved ? $saved['icon_id'] : $this->topic->icon_id);
     }
     // Run onKunenaPrepare event.
     $params = new JRegistry();
     $params->set('ksource', 'kunena');
     $params->set('kunena_view', 'topic');
     $params->set('kunena_layout', 'reply');
     $dispatcher = JEventDispatcher::getInstance();
     JPluginHelper::importPlugin('kunena');
     $dispatcher->trigger('onKunenaPrepare', array('kunena.topic', &$this->topic, &$params, 0));
     $this->action = 'edit';
     // Get attachments.
     $this->attachments = $this->message->getAttachments();
     // Get poll.
     if ($this->message->parent == 0 && $this->topic->isAuthorised(!$this->topic->poll_id ? 'poll.create' : 'poll.edit')) {
         $this->poll = $this->topic->getPoll();
     }
     $this->allowedExtensions = KunenaAttachmentHelper::getExtensions($this->category);
     if ($saved) {
         // Update message contents.
         $this->message->edit($saved);
     }
     $this->post_anonymous = isset($saved['anonymous']) ? $saved['anonymous'] : !empty($this->category->post_anonymous);
     $this->subscriptionschecked = isset($saved['subscribe']) ? $saved['subscribe'] : $this->config->subscriptionschecked == 1;
     $this->modified_reason = isset($saved['modified_reason']) ? $saved['modified_reason'] : '';
     $this->app->setUserState('com_kunena.postfields', null);
     $this->canSubscribe = $this->canSubscribe();
     $this->headerText = JText::_('COM_KUNENA_POST_EDIT') . ' ' . $this->topic->subject;
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:50,代码来源:display.php

示例8: getParent

 /**
  * @return KunenaForumMessage
  */
 public function getParent()
 {
     return KunenaForumMessageHelper::get($this->parent);
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:7,代码来源:message.php

示例9: getTopic

	public function getTopic() {
		$topic = KunenaForumTopicHelper::get($this->getState ( 'item.id'));
		$ids = array();
		// If topic has been moved, find the new topic
		while ($topic->moved_id) {
			if (isset($ids[$topic->moved_id])) {
				// Break on loops
				return false;
			}
			$ids[$topic->moved_id] = 1;
			$topic = KunenaForumTopicHelper::get($topic->moved_id);
		}
		// If topic doesn't exist, check if there's a message with the same id
		if (! $topic->exists()) {
			$message = KunenaForumMessageHelper::get($this->getState ( 'item.id'));
			if ($message->exists()) {
				$topic = KunenaForumTopicHelper::get($message->thread);
			}
		}
		$this->topic = $topic;
		return $topic;
	}
开发者ID:rich20,项目名称:Kunena,代码行数:22,代码来源:topic.php

示例10: convert

 public static function convert($uri, $showstart = 1)
 {
     // Make sure that input is JUri to legacy Kunena func=xxx
     if (!$uri instanceof JUri) {
         return;
     }
     if ($uri->getVar('option') != 'com_kunena') {
         return;
     }
     KUNENA_PROFILER ? KunenaProfiler::instance()->start('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
     if ($uri->getVar('func')) {
         $uri->setVar('view', $uri->getVar('func'));
         $uri->delVar('func');
     }
     if (!isset(self::$functions[$uri->getVar('view')])) {
         KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
         return;
     }
     $legacy = clone $uri;
     // Turn &do=xxx into &layout=xxx
     if ($uri->getVar('do')) {
         $uri->setVar('layout', $uri->getVar('do'));
         $uri->delVar('do');
     }
     $app = JFactory::getApplication();
     $config = KunenaFactory::getConfig();
     $changed = false;
     switch ($uri->getVar('view')) {
         case 'entrypage':
             $changed = true;
             $uri->setVar('view', 'home');
             break;
         case 'listcat':
             $changed = true;
             $uri->setVar('view', 'category');
             $uri->setVar('layout', 'list');
             break;
         case 'showcat':
             $changed = true;
             $uri->setVar('view', 'category');
             $page = (int) $uri->getVar('page', $showstart);
             if ($page > 0) {
                 $uri->setVar('limitstart', (int) $config->messages_per_page * ($page - 1));
                 $uri->setVar('limit', (int) $config->messages_per_page);
             }
             $uri->delVar('page');
             break;
         case 'latest':
         case 'mylatest':
         case 'noreplies':
         case 'subscriptions':
         case 'favorites':
         case 'userposts':
         case 'unapproved':
         case 'deleted':
             $changed = true;
             $uri->setVar('view', 'topics');
             // Handle both &func=noreplies and &func=latest&do=noreplies
             $mode = $uri->getVar('layout') ? $uri->getVar('layout') : $uri->getVar('view');
             switch ($mode) {
                 case 'latest':
                     $uri->setVar('layout', 'default');
                     $uri->setVar('mode', 'replies');
                     break;
                 case 'unapproved':
                     $uri->setVar('layout', 'default');
                     $uri->setVar('mode', 'unapproved');
                     break;
                 case 'deleted':
                     $uri->setVar('layout', 'default');
                     $uri->setVar('mode', 'deleted');
                     break;
                 case 'noreplies':
                     $uri->setVar('layout', 'default');
                     $uri->setVar('mode', 'noreplies');
                     break;
                 case 'latesttopics':
                     $uri->setVar('layout', 'default');
                     $uri->setVar('mode', 'topics');
                     break;
                 case 'mylatest':
                     $uri->setVar('layout', 'user');
                     $uri->setVar('mode', 'default');
                     break;
                 case 'subscriptions':
                     $uri->setVar('layout', 'user');
                     $uri->setVar('mode', 'subscriptions');
                     break;
                 case 'favorites':
                     $uri->setVar('layout', 'user');
                     $uri->setVar('mode', 'favorites');
                     break;
                 case 'owntopics':
                     $uri->setVar('layout', 'user');
                     $uri->setVar('mode', 'started');
                     break;
                 case 'userposts':
                     $uri->setVar('userid', '0');
                     // Continue in latestposts
                 // Continue in latestposts
//.........这里部分代码省略.........
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:101,代码来源:legacy.php

示例11: getInstance

	/**
	 * Returns KunenaForumMessage object
	 *
	 * @access	public
	 * @param	identifier		The message to load - Can be only an integer.
	 * @return	KunenaForumMessage		The message object.
	 * @since	1.7
	 */
	static public function getInstance($identifier = null, $reload = false) {
		return KunenaForumMessageHelper::get($identifier, $reload);
	}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:11,代码来源:message.php

示例12: getItem

 /**
  * Method to get a content item to index.
  *
  * @param   integer  $id  The id of the content item.
  *
  * @return  FinderIndexerResult  A FinderIndexerResult object.
  *
  * @since   2.5
  * @throws  Exception on database error.
  */
 protected function getItem($id)
 {
     JLog::add('FinderIndexerAdapter::getItem', JLog::INFO);
     $message = KunenaForumMessageHelper::get($id);
     // Convert the item to a result object.
     $item = $this->{$this}->createIndexerResult($message);
     unset($message);
     KunenaForumMessageHelper::clean();
     return $item;
 }
开发者ID:laiello,项目名称:senluonirvana,代码行数:20,代码来源:kunena.php

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

示例14: before

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

示例15: report

 function report()
 {
     if (!JSession::checkToken('post')) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
         $this->setRedirectBack();
         return;
     }
     if (!$this->me->exists() || $this->config->reportmsg == 0) {
         // Deny access if report feature has been disabled or user is guest
         $this->app->enqueueMessage(JText::_('COM_KUNENA_NO_ACCESS'), 'notice');
         $this->setRedirectBack();
         return;
     }
     if (!$this->config->get('send_emails')) {
         // Emails have been disabled
         $this->app->enqueueMessage(JText::_('COM_KUNENA_EMAIL_DISABLED'), 'notice');
         $this->setRedirectBack();
         return;
     }
     if (!$this->config->getEmail() || !JMailHelper::isEmailAddress($this->config->getEmail())) {
         // Error: email address is invalid
         $this->app->enqueueMessage(JText::_('COM_KUNENA_EMAIL_INVALID'), 'error');
         $this->setRedirectBack();
         return;
     }
     // Get target object for the report
     if ($this->mesid) {
         $message = $target = KunenaForumMessageHelper::get($this->mesid);
         $topic = $target->getTopic();
     } else {
         $topic = $target = KunenaForumTopicHelper::get($this->id);
         $message = KunenaForumMessageHelper::get($topic->first_post_id);
     }
     $messagetext = $message->message;
     $baduser = KunenaFactory::getUser($message->userid);
     if (!$target->authorise('read')) {
         // Deny access if user cannot read target
         $this->app->enqueueMessage($target->getError(), 'notice');
         $this->setRedirectBack();
         return;
     }
     $reason = JRequest::getString('reason');
     $text = JRequest::getString('text');
     $template = KunenaTemplate::getInstance();
     if (method_exists($template, 'reportMessage')) {
         $template->reportMessage($message, $reason, $text);
     }
     // Load language file from the template.
     KunenaFactory::getTemplate()->loadLanguage();
     if (empty($reason) && empty($text)) {
         // Do nothing: empty subject or reason is empty
         $this->app->enqueueMessage(JText::_('COM_KUNENA_REPORT_FORG0T_SUB_MES'));
         $this->setRedirectBack();
         return;
     } else {
         $acl = KunenaAccess::getInstance();
         $emailToList = $acl->getSubscribers($topic->category_id, $topic->id, false, true, false);
         if (!empty($emailToList)) {
             $mailsender = JMailHelper::cleanAddress($this->config->board_title . ' ' . JText::_('COM_KUNENA_FORUM') . ': ' . $this->me->getName());
             $mailsubject = "[" . $this->config->board_title . " " . JText::_('COM_KUNENA_FORUM') . "] " . JText::_('COM_KUNENA_REPORT_MSG') . ": ";
             if ($reason) {
                 $mailsubject .= $reason;
             } else {
                 $mailsubject .= $topic->subject;
             }
             jimport('joomla.environment.uri');
             $msglink = JUri::getInstance()->toString(array('scheme', 'host', 'port')) . $target->getPermaUrl(null, false);
             $mail = JFactory::getMailer();
             $mail->setSender(array($this->me->username, $this->me->email));
             $mail->setSubject($mailsubject);
             // Render the email.
             $layout = KunenaLayout::factory('Email/Report')->debug(false)->set('mail', $mail)->set('message', $message)->set('me', $this->me)->set('title', $reason)->set('content', $text)->set('messageLink', $msglink);
             try {
                 $body = trim($layout->render());
                 $mail->setBody($body);
             } catch (Exception $e) {
                 // TODO: Deprecated in K4.0, remove in K5.0
                 $mailmessage = "" . JText::_('COM_KUNENA_REPORT_RSENDER') . " {$this->me->username} ({$this->me->name})";
                 $mailmessage .= "\n";
                 $mailmessage .= "" . JText::_('COM_KUNENA_REPORT_RREASON') . " " . $reason;
                 $mailmessage .= "\n";
                 $mailmessage .= "" . JText::_('COM_KUNENA_REPORT_RMESSAGE') . " " . $text;
                 $mailmessage .= "\n\n";
                 $mailmessage .= "" . JText::_('COM_KUNENA_REPORT_POST_POSTER') . " {$baduser->username} ({$baduser->name})";
                 $mailmessage .= "\n";
                 $mailmessage .= "" . JText::_('COM_KUNENA_REPORT_POST_SUBJECT') . ": " . $topic->subject;
                 $mailmessage .= "\n";
                 $mailmessage .= "" . JText::_('COM_KUNENA_REPORT_POST_MESSAGE') . "\n-----\n" . KunenaHtmlParser::stripBBCode($messagetext, 0, false);
                 $mailmessage .= "\n-----\n\n";
                 $mailmessage .= "" . JText::_('COM_KUNENA_REPORT_POST_LINK') . " " . $msglink;
                 $mailmessage = JMailHelper::cleanBody(strtr($mailmessage, array('&#32;' => '')));
                 $mail->setBody($mailmessage);
             }
             $receivers = array();
             foreach ($emailToList as $emailTo) {
                 if (!$emailTo->email || !JMailHelper::isEmailAddress($emailTo->email)) {
                     continue;
                 }
                 $receivers[] = $emailTo->email;
             }
//.........这里部分代码省略.........
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:101,代码来源:topic.php


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