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


PHP KunenaForumTopicHelper类代码示例

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


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

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

示例2: recount

	function recount() {
		$app = JFactory::getApplication ();
		$state = $app->getUserState ( 'com_kunena.admin.recount', null );

		if ($state === null) {
			// First run
			$query = "SELECT MAX(id) FROM #__kunena_messages";
			$db = JFactory::getDBO();
			$db->setQuery ( $query );
			$state = new StdClass();
			$state->step = 0;
			$state->maxId = (int) $db->loadResult ();
			$state->start = 0;
		}

		$this->checkTimeout();
		while (1) {
			$count = mt_rand(95000, 105000);
			switch ($state->step) {
				case 0:
					// Update topic statistics
					kimport('kunena.forum.topic.helper');
					KunenaForumTopicHelper::recount(false, $state->start, $state->start+$count);
					$state->start += $count;
					//$app->enqueueMessage ( JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_TOPICS', min($state->start, $state->maxId), $state->maxId) );
					break;
				case 1:
					// Update usertopic statistics
					kimport('kunena.forum.topic.user.helper');
					KunenaForumTopicUserHelper::recount(false, $state->start, $state->start+$count);
					$state->start += $count;
					//$app->enqueueMessage ( JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_USERTOPICS', min($state->start, $state->maxId), $state->maxId) );
					break;
				case 2:
					// Update user statistics
					kimport('kunena.user.helper');
					KunenaUserHelper::recount();
					//$app->enqueueMessage ( JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_USER') );
					break;
				case 3:
					// Update category statistics
					kimport('kunena.forum.category.helper');
					KunenaForumCategoryHelper::recount();
					//$app->enqueueMessage ( JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_CATEGORY') );
					break;
				default:
					$app->setUserState ( 'com_kunena.admin.recount', null );
					$app->enqueueMessage (JText::_('COM_KUNENA_RECOUNTFORUMS_DONE'));
					$this->setRedirect(KunenaRoute::_('index.php?option=com_kunena', false));
					return;
			}
			if (!$state->start || $state->start > $state->maxId) {
				$state->step++;
				$state->start = 0;
			}
			if ($this->checkTimeout()) break;
		}
		$app->setUserState ( 'com_kunena.admin.recount', $state );
		$this->setRedirect(KunenaRoute::_('index.php?option=com_kunena&view=recount&task=recount', false));
	}
开发者ID:rich20,项目名称:Kunena,代码行数:60,代码来源:recount.php

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

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

示例5: getTopicOptions

	/**
	 * Method to get the options of the topic
	 *
	 * @return array
	 */
	public function getTopicOptions()
	{
		$options = array();

		// Start with default options.
		if (!$this->message)
		{
			$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'));

		// Then list a few topics.
		$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->category->id, 0, 30, $params);

		foreach ($topics as $topic)
		{
			$options[] = JHtml::_('select.option', $topic->id, $this->escape($topic->subject));
		}

		return $options;
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:35,代码来源:moderate.php

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

示例7: getSubscriptions

	public function getSubscriptions()
	{
		$db     = JFactory::getDBO();
		$userid = $this->getState($this->getName() . '.id');

		$db->setQuery("SELECT topic_id AS thread FROM #__kunena_user_topics WHERE user_id='$userid' AND subscribed=1");
		$subslist = (array) $db->loadObjectList();

		if (KunenaError::checkDatabaseError())
		{
			return array();
		}

		$topic_list = array();

		if (!empty($subslist))
		{
			foreach ($subslist as $sub)
			{
				$topic_list[] = $sub->thread;
			}

			$topic_list = KunenaForumTopicHelper::getTopics($topic_list);
		}

		return $topic_list;
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:27,代码来源:user.php

示例8: testGetTopics

	/**
	 * Test getTopics()
	 */
	public function testGetTopics() {
		list($count, $topics) = KunenaForumTopicHelper::getLatestTopics(false, 0, 20);
		$topicusers = KunenaForumTopicUserHelper::getTopics($topics);
		foreach ($topics as $topic) {
			$this->assertTrue(isset($topicusers[$topic->id]));
			$this->assertEquals($topic->id, $topicusers[$topic->id]->topic_id);
		}
	}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:11,代码来源:KunenaForumTopicUserHelperTest.php

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

示例10: testNew

	/**
	 * Test new KunenaForumTopicUser()
	 */
	public function testNew() {
		$admin = KunenaFactory::getUser('admin');
		list($count, $topics) = KunenaForumTopicHelper::getLatestTopics(false, 0, 1);
		self::$topic = reset($topics);
		$topicuser = new KunenaForumTopicUser(self::$topic->id, $admin);
		$this->assertInstanceOf('KunenaForumTopicUser', $topicuser);
		$this->assertFalse($topicuser->exists());
		$this->assertEquals(self::$topic->id, $topicuser->topic_id);
		$this->assertEquals($admin->userid, $topicuser->user_id);
	}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:13,代码来源:KunenaForumTopicUserTest.php

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

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

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

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

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


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