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


PHP KunenaForumTopicHelper::get方法代码示例

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


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

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

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

示例5: check

 public function check()
 {
     $user = KunenaUserHelper::get($this->user_id);
     $topic = KunenaForumTopicHelper::get($this->topic_id);
     if (!$user->exists()) {
         $this->setError(JText::sprintf('COM_KUNENA_LIB_TABLE_USERTOPICS_ERROR_USER_INVALID', (int) $user->userid));
     }
     if (!$topic->exists()) {
         $this->setError(JText::sprintf('COM_KUNENA_LIB_TABLE_USERTOPICS_ERROR_TOPIC_INVALID', (int) $topic->id));
     }
     $this->category_id = $topic->category_id;
     return $this->getError() == '';
 }
开发者ID:sillysachin,项目名称:teamtogether,代码行数:13,代码来源:kunenausertopics.php

示例6: __construct

 /**
  * @param mixed $topic
  * @param mixed $user
  *
  * @internal
  */
 public function __construct($topic = null, $user = null)
 {
     $topic = KunenaForumTopicHelper::get($topic);
     // Always fill empty data
     $this->_db = JFactory::getDBO();
     // Create the table object
     $table = $this->getTable();
     // Lets bind the data
     $this->setProperties($table->getProperties());
     $this->_exists = false;
     $this->topic_id = $topic->exists() ? $topic->id : null;
     $this->category_id = $topic->exists() ? $topic->category_id : null;
     $this->user_id = KunenaUserHelper::get($user)->userid;
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:20,代码来源:read.php

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

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

示例9: getMessagesByTopic

	static public function getMessagesByTopic($topic, $start=0, $limit=0, $ordering='ASC', $hold=0, $orderbyid = false) {
		$topic = KunenaForumTopicHelper::get($topic);
		if (!$topic->exists())
			return array();
		$total = $topic->getTotal();

		if ($start < 0)
			$start = 0;
		if ($limit < 1)
			$limit = KunenaFactory::getConfig()->messages_per_page;
		// If out of range, use last page
		if ($total < $start)
			$start = intval($total / $limit) * $limit;
		$ordering = strtoupper($ordering);
		if ($ordering != 'DESC')
			$ordering = 'ASC';

		return self::loadMessagesByTopic($topic->id, $start, $limit, $ordering, $hold, $orderbyid);
	}
开发者ID:rich20,项目名称:Kunena,代码行数:19,代码来源:helper.php

示例10: displayModerate

 protected function displayModerate($tpl = null)
 {
     $this->mesid = JRequest::getInt('mesid', 0);
     $this->id = $this->state->get('item.id');
     $this->catid = $this->state->get('item.catid');
     if ($this->config->topicicons) {
         $this->topicIcons = $this->ktemplate->getTopicIcons(false);
     }
     if (!$this->mesid) {
         $this->topic = KunenaForumTopicHelper::get($this->id);
         if (!$this->topic->authorise('move')) {
             $this->app->enqueueMessage($this->topic->getError(), 'notice');
             return;
         }
     } else {
         $this->message = KunenaForumMessageHelper::get($this->mesid);
         if (!$this->message->authorise('move')) {
             $this->app->enqueueMessage($this->message->getError(), 'notice');
             return;
         }
         $this->topic = $this->message->getTopic();
     }
     $this->category = $this->topic->getCategory();
     $options = array();
     if (!$this->mesid) {
         $options[] = JHtml::_('select.option', 0, JText::_('COM_KUNENA_MODERATION_MOVE_TOPIC'));
     } else {
         $options[] = JHtml::_('select.option', 0, JText::_('COM_KUNENA_MODERATION_CREATE_TOPIC'));
     }
     $options[] = JHtml::_('select.option', -1, JText::_('COM_KUNENA_MODERATION_ENTER_TOPIC'));
     $db = JFactory::getDBO();
     $params = array('orderby' => 'tt.last_post_time DESC', 'where' => " AND tt.id != {$db->Quote($this->topic->id)} ");
     list($total, $topics) = KunenaForumTopicHelper::getLatestTopics($this->catid, 0, 30, $params);
     foreach ($topics as $cur) {
         $options[] = JHtml::_('select.option', $cur->id, $this->escape($cur->subject));
     }
     $this->topiclist = JHtml::_('select.genericlist', $options, 'targettopic', 'class="inputbox"', 'value', 'text', 0, 'kmod_topics');
     $options = array();
     $cat_params = array('sections' => 0, 'catid' => 0);
     $this->categorylist = JHtml::_('kunenaforum.categorylist', 'targetcategory', 0, $options, $cat_params, 'class="inputbox kmove_selectbox"', 'value', 'text', $this->catid, 'kmod_categories');
     if (isset($this->message)) {
         $this->user = KunenaFactory::getUser($this->message->userid);
         $username = $this->message->getAuthor()->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->mesid) {
         // Get thread and reply count from current message:
         $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->mesid)}";
         $db->setQuery($query, 0, 1);
         $this->replies = $db->loadResult();
         if (KunenaError::checkDatabaseError()) {
             return;
         }
     }
     $this->render('Topic/Moderate', $tpl);
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:56,代码来源:view.html.php

示例11: getTopic

 /**
  * Resolve/get current topic.
  *
  * @return  KunenaForumTopic  Returns this topic or move target if this was moved.
  *
  * @throws  RuntimeException  If there is a redirect loop on moved_id.
  *
  * @since  K4.0
  */
 public function getTopic()
 {
     $ids = array();
     $topic = $this;
     // If topic has been moved, find the new topic
     while ($topic->moved_id) {
         if (isset($ids[$topic->moved_id])) {
             throw new RuntimeException(JText::_('COM_KUNENA_VIEW_TOPIC_ERROR_LOOP'), 500);
         }
         $ids[$topic->moved_id] = 1;
         $topic = KunenaForumTopicHelper::get($topic->moved_id);
     }
     return $topic;
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:23,代码来源:topic.php

示例12: getInstance

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

示例13: KunenaParseRoute

function KunenaParseRoute($segments) {
	$profiler = JProfiler::getInstance('Application');
	KUNENA_PROFILER ? $profiler->mark('kunenaRoute') : null;
	$starttime = $profiler->getmicrotime();

	// Get current menu item and get query variables from it
	$active = JFactory::getApplication()->getMenu ()->getActive ();
	$vars = isset ( $active->query ) ? $active->query : array ('view'=>'home');
	if (empty($vars['view']) || $vars['view']=='home' || $vars['view']=='entrypage') {
		$vars['view'] = '';
	}

	// Fix bug in Joomla 1.5 when using /components/kunena instead /component/kunena
	if (!$active && $segments[0] == 'kunena') array_shift ( $segments );

	// Enable SEF category feature
	$sefcats = KunenaRoute::$config->sefcats && isset(KunenaRouter::$sefviews[$vars['view']]) && empty($vars ['id']);

	// Handle all segments
	while ( ($segment = array_shift ( $segments )) !== null ) {
		$seg = explode ( ':', $segment );
		$var = array_shift ( $seg );
		$value = array_shift ( $seg );

		if (is_numeric ( $var )) {
			$value = (int) $var;
			if ($vars['view'] == 'user') {
				$var = 'userid';
			} else {
				// Numeric variable is always catid or id
				if (empty($vars ['catid'])
					|| (empty($vars ['id']) && KunenaForumCategoryHelper::get($value)->exists() && KunenaForumTopicHelper::get($value)->category_id != $vars ['catid'])) {
					// First numbers are always categories
					// FIXME: what if $topic->catid == catid
					$var = 'catid';
					$vars ['view'] = 'category';
				} elseif (empty($vars ['id'])) {
					// Next number is always topic
					$var = 'id';
					$vars ['view'] = 'topic';
					$sefcats = false;
				} elseif (empty($vars ['mesid'])) {
					// Next number is always message
					$var = 'mesid';
					$vars ['view'] = 'topic';
				} else {
					// Invalid parameter, skip it
					continue;
				}
			}
		} elseif (empty ( $var ) && empty ( $value )) {
			// Empty parameter, skip it
			continue;
		} elseif ($sefcats && (($value !== null && ! isset ( KunenaRouter::$parsevars[$var] ))
		|| ($value === null && ! isset ( KunenaRouter::$views[$var] ) && ! isset ( KunenaRouter::$layouts[$var] ) && ! isset ( KunenaRouter::$functions[$var] )))) {
			// We have SEF category: translate category name into catid=123
			// TODO: cache filtered values to gain some speed -- I would like to start using category names instead of catids if it gets fast enough
			$var = 'catid';
			$value = -1;
			$catname = strtr ( $segment, ':', '-' );
			$categories = empty($vars ['catid']) ? KunenaForumCategoryHelper::getCategories() : KunenaForumCategoryHelper::getChildren($vars ['catid']);
			foreach ( $categories as $category ) {
				if ($catname == KunenaRouter::filterOutput ( $category->name ) || $catname == JFilterOutput::stringURLSafe ( $category->name )) {
					$value = (int) $category->id;
					break;
				}
			}
			$vars ['view'] = 'category';
		} elseif ($value === null) {
			// Variable must be either view or layout
			$sefcats = false;
			$value = $var;
			if (empty($vars ['view']) || ($value=='topic' && $vars ['view'] == 'category')) {
				$var = 'view';
			} elseif (empty($vars ['layout'])) {
				$var = 'layout';
			} else {
				// Unknown parameter: continue
				if (!empty($vars ['view'])) continue;
				// Oops: unknown view or non-existing category
				$var = 'view';
			}
		}
		$vars [$var] = $value;
	}
	if (empty($vars ['layout'])) $vars ['layout'] = 'default';
	KunenaRouter::$time = $profiler->getmicrotime() - $starttime;
	return $vars;
}
开发者ID:rich20,项目名称:Kunena,代码行数:89,代码来源:router.php

示例14: update

 protected function update($newTopic = false)
 {
     // If post was published and then moved, we need to update old topic
     if (!$this->_hold && $this->_thread && $this->_thread != $this->thread) {
         $topic = KunenaForumTopicHelper::get($this->_thread);
         if (!$topic->update($this, -1)) {
             $this->setError($topic->getError());
         }
     }
     $postDelta = $this->delta(true);
     $topic = $this->getTopic();
     // New topic
     if ($newTopic) {
         $topic->hold = 0;
     }
     // Update topic
     if (!$this->hold && $topic->hold && $topic->exists()) {
         // We published message -> publish and recount topic
         $topic->hold = 0;
         $topic->recount();
     } elseif (!$topic->update($this, $postDelta)) {
         $this->setError($topic->getError());
     }
     // Activity integration
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('finder');
     $activity = KunenaFactory::getActivityIntegration();
     if ($postDelta < 0) {
         $dispatcher->trigger('onDeleteKunenaPost', array(array($this->id)));
         $activity->onAfterDelete($this);
     } elseif ($postDelta > 0) {
         $topic->markRead();
         if ($this->parent == 0) {
             $activity->onAfterPost($this);
         } else {
             $activity->onAfterReply($this);
         }
     }
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:39,代码来源:message.php

示例15: showPlugin

 /**
  * @param  int    $catid
  * @param  int    $topic_id
  * @param  object $row
  * @param  bool   $linkOnly
  *
  * @return mixed|string
  */
 protected function showPlugin($catid, $topic_id, &$row, $linkOnly)
 {
     // Show a simple form to allow posting to forum from the plugin
     $plgShowForm = $this->params->get('form', 1);
     // Default is to put QuickPost at the very bottom.
     $formLocation = $this->params->get('form_location', 0);
     // Don't repeat the CSS for each instance of this plugin in a page!
     if (!self::$includedCss) {
         $doc = JFactory::getDocument();
         $doc->addStyleSheet(JUri::root(true) . "/plugins/content/kunenadiscuss/css/discuss.css");
         self::$includedCss = true;
     }
     // Find cross reference and the real topic
     $db = $this->db;
     $query = $db->getQuery(true)->select($db->quoteName('thread_id'))->from('#__kunenadiscuss')->where("content_id = {$db->quote($row->id)}");
     $this->db->setQuery($query);
     $result = $this->db->loadResult();
     KunenaError::checkDatabaseError();
     if ($topic_id) {
         // Custom topic found
         $this->debug("showPlugin: Loading Custom Topic {$topic_id}");
         $id = $topic_id;
     } elseif ($result) {
         // Reference found
         $this->debug("showPlugin: Loading Stored Topic {$result}");
         $id = $result;
     } else {
         // No topic exists
         $this->debug("showPlugin: No topic found");
         $id = 0;
     }
     $topic = KunenaForumTopicHelper::get($id);
     // If topic has been moved, find the real topic
     while ($topic->moved_id) {
         $this->debug("showPlugin: Topic {$topic->id} has been moved to {$topic->moved_id}");
         $topic = KunenaForumTopicHelper::get($topic->moved_id);
     }
     if ($result) {
         if (!$topic->exists()) {
             $this->debug("showPlugin: Topic does not exist, removing reference to {$result}");
             $this->deleteReference($row);
         } elseif ($topic->id != $id) {
             $this->debug("showPlugin: Topic has been moved or changed, updating reference to {$topic->id}");
             $this->updateReference($row, $topic->id);
         }
     } elseif ($topic_id && $topic->exists()) {
         $this->debug("showPlugin: First hit to Custom Topic, created reference to topic {$topic_id}");
         $this->createReference($row, $topic_id);
     }
     // Initialise some variables
     $subject = $row->title;
     if (isset($row->publish_up) && $row->publish_up != '0000-00-00 00:00:00') {
         $published = JFactory::getDate($row->publish_up)->toUnix();
         // take start publishing date
     } else {
         $published = JFactory::getDate($row->created)->toUnix();
         // or created date if publish_up is empty
     }
     $now = JFactory::getDate()->toUnix();
     if ($topic->exists()) {
         // If current user doesn't have authorisation to read existing topic, we are done
         if ($id && !$topic->authorise('read')) {
             $this->debug("showPlugin: Topic said {$topic->getError()}");
             return '';
         }
         $category = $topic->getCategory();
     } else {
         $this->debug("showPlugin: Let's see what we can do..");
         // If current user doesn't have authorisation to read category, we are done
         $category = KunenaForumCategoryHelper::get($catid);
         if (!$category->authorise('read')) {
             $this->debug("showPlugin: Category {$catid} said {$category->getError()}");
             return '';
         }
         $create = $this->params->get('create', 0);
         $createTime = $this->params->get('create_time', 0) * 604800;
         // Weeks in seconds
         if ($createTime && $published + $createTime < $now) {
             $this->debug("showPlugin: Topic creation time expired, cannot start new discussion anymore");
             return '';
         }
         if ($create) {
             $this->debug("showPlugin: First hit, created new topic {$topic_id} into forum");
             $topic = $this->createTopic($row, $category, $subject);
             if ($topic === false) {
                 return '';
             }
         }
     }
     // Do we allow answers into the topic?
     $closeTime = $this->params->get('close_time', 0) * 604800;
     // Weeks in seconds or 0 (forever)
//.........这里部分代码省略.........
开发者ID:810,项目名称:Kunena-Addons,代码行数:101,代码来源:kunenadiscuss.php


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