本文整理汇总了PHP中KunenaForumTopicHelper类的典型用法代码示例。如果您正苦于以下问题:PHP KunenaForumTopicHelper类的具体用法?PHP KunenaForumTopicHelper怎么用?PHP KunenaForumTopicHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KunenaForumTopicHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: 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
示例17: 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
示例18: doprune
function doprune() {
$app = JFactory::getApplication ();
if (!JRequest::checkToken()) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
$this->setRedirect(KunenaRoute::_($this->baseurl, false));
return;
}
$category = KunenaForumCategoryHelper::get(JRequest::getInt ( 'prune_forum', 0 ));
if (!$category->authorise('admin')) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_CHOOSEFORUMTOPRUNE' ), 'error' );
$this->setRedirect(KunenaRoute::_($this->baseurl, false));
return;
}
// Convert days to seconds for timestamp functions...
$prune_days = JRequest::getInt ( 'prune_days', 36500 );
$prune_date = JFactory::getDate()->toUnix() - ($prune_days * 86400);
$trashdelete = JRequest::getInt( 'trashdelete', 0);
// Get up to 100 oldest topics to be deleted
$params = array(
'orderby'=>'tt.last_post_time ASC',
'where'=>"AND tt.last_post_time<{$prune_date} AND ordering=0",
);
list($count, $topics) = KunenaForumTopicHelper::getLatestTopics($category->id, 0, 100, $params);
$deleted = 0;
foreach ( $topics as $topic ) {
$deleted++;
if ( $trashdelete ) $topic->delete(false);
else $topic->trash();
}
KunenaUserHelper::recount();
KunenaForumCategoryHelper::recount();
KunenaForumMessageAttachmentHelper::cleanup();
if ( $trashdelete ) $app->enqueueMessage ( "" . JText::_('COM_KUNENA_FORUMPRUNEDFOR') . " " . $prune_days . " " . JText::_('COM_KUNENA_PRUNEDAYS') . "; " . JText::_('COM_KUNENA_PRUNEDELETED') . " {$deleted}/{$count} " . JText::_('COM_KUNENA_PRUNETHREADS') );
else $app->enqueueMessage ( "" . JText::_('COM_KUNENA_FORUMPRUNEDFOR') . " " . $prune_days . " " . JText::_('COM_KUNENA_PRUNEDAYS') . "; " . JText::_('COM_KUNENA_PRUNETRASHED') . " {$deleted}/{$count} " . JText::_('COM_KUNENA_PRUNETHREADS') );
$this->setRedirect(KunenaRoute::_($this->baseurl, false));
}
开发者ID:rich20,项目名称:Kunena,代码行数:39,代码来源:prune.php
示例19: loadTopPolls
/**
* @param int $limit
*
* @return array
*/
public function loadTopPolls($limit = 0)
{
$limit = $limit ? $limit : $this->_config->poppollscount;
if (count($this->topPolls) < $limit) {
$query = "SELECT poll.threadid AS id, SUM(opt.votes) AS count\n\t\t\t\t\tFROM #__kunena_polls_options AS opt\n\t\t\t\t\tINNER JOIN #__kunena_polls AS poll ON poll.id=opt.pollid\n\t\t\t\t\tGROUP BY pollid\n\t\t\t\t\tHAVING count > 0\n\t\t\t\t\tORDER BY count DESC";
$this->_db->setQuery($query, 0, $limit);
$polls = (array) $this->_db->loadObjectList('id');
KunenaError::checkDatabaseError();
$this->topPolls = KunenaForumTopicHelper::getTopics(array_keys($polls));
$top = reset($this->topPolls);
if (!$top) {
return array();
}
$top->title = JText::_('COM_KUNENA_LIB_STAT_TOP_POLLS');
$top->titleName = JText::_('COM_KUNENA_POLL_STATS_NAME');
$top->titleCount = JText::_('COM_KUNENA_USRL_VOTES');
$top->count = $polls[$top->id]->count;
foreach ($this->topPolls as &$item) {
$item = clone $item;
$item->count = $polls[$item->id]->count;
$item->link = JHtml::_('kunenaforum.link', $item->getUri(), KunenaHtmlParser::parseText($item->subject));
$item->percent = round(100 * $item->count / $top->count);
}
}
return array_slice($this->topPolls, 0, $limit);
}
开发者ID:sillysachin,项目名称:teamtogether,代码行数:31,代码来源:statistics.php
示例20: dorecount
/**
* Perform recount on statistics in smaller chunks.
*
* @return void
* @throws Exception
*/
public function dorecount()
{
$ajax = $this->input->getWord('format', 'html') == 'json';
if (!JSession::checkToken('request')) {
$this->setResponse(array('success' => false, 'header' => JText::_('COM_KUNENA_AJAX_ERROR'), 'message' => JText::_('COM_KUNENA_AJAX_DETAILS_BELOW'), 'error' => JText::_('COM_KUNENA_ERROR_TOKEN')), $ajax);
$this->setRedirect(KunenaRoute::_($this->baseurl, false));
return;
}
$state = $this->app->getUserState('com_kunena.admin.recount', null);
try {
$this->checkTimeout();
while (1) {
// Topic count per run.
// TODO: count isn't accurate as it can overflow total.
$count = mt_rand(4500, 5500);
switch ($state->step) {
case 0:
if ($state->topics) {
// Update topic statistics
KunenaForumTopicHelper::recount(false, $state->start, $state->start + $count);
$state->start += $count;
$msg = JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_TOPICS_X', round(min(100 * $state->start / $state->maxId + 1, 100)) . '%');
}
break;
case 1:
if ($state->usertopics) {
// Update user's topic statistics
KunenaForumTopicUserHelper::recount(false, $state->start, $state->start + $count);
$state->start += $count;
$msg = JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_USERTOPICS_X', round(min(100 * $state->start / $state->maxId + 1, 100)) . '%');
}
break;
case 2:
if ($state->categories) {
// Update category statistics
KunenaForumCategoryHelper::recount();
KunenaForumCategoryHelper::fixAliases();
$msg = JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_CATEGORIES_X', '100%');
}
break;
case 3:
if ($state->users) {
// Update user statistics
KunenaUserHelper::recount();
$msg = JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_USERS_X', '100%');
}
break;
case 4:
if ($state->polls) {
// Update user statistics
KunenaForumTopicPollHelper::recount();
$msg = JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_POLLS_X', '100%');
}
break;
default:
$header = JText::_('COM_KUNENA_RECOUNTFORUMS_DONE');
$msg = JText::_('COM_KUNENA_AJAX_REQUESTED_RECOUNTED');
$this->app->setUserState('com_kunena.admin.recount', null);
$this->setResponse(array('success' => true, 'status' => '100%', 'header' => $header, 'message' => $msg), $ajax);
$this->setRedirect(KunenaRoute::_($this->baseurl, false), $header);
return;
}
$state->current = min($state->current + $count, $state->total);
if (!$state->start || $state->start > $state->maxId) {
$state->step++;
$state->start = 0;
}
if ($this->checkTimeout()) {
break;
}
}
$state->reload++;
$this->app->setUserState('com_kunena.admin.recount', $state);
} catch (Exception $e) {
if (!$ajax) {
throw $e;
}
$this->setResponse(array('success' => false, 'status' => sprintf("%2.1f%%", 99 * $state->current / ($state->total + 1)), 'header' => JText::_('COM_KUNENA_AJAX_ERROR'), 'message' => JText::_('COM_KUNENA_AJAX_DETAILS_BELOW'), 'error' => $e->getMessage()), $ajax);
}
$token = JSession::getFormToken() . '=1';
$redirect = KunenaRoute::_("{$this->baseurl}&task=dorecount&i={$state->reload}&{$token}", false);
$this->setResponse(array('success' => true, 'status' => sprintf("%2.1f%%", 99 * $state->current / ($state->total + 1)), 'header' => JText::_('COM_KUNENA_AJAX_RECOUNT_WAIT'), 'message' => $msg, 'href' => $redirect), $ajax);
}
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:89,代码来源:tools.php
注:本文中的KunenaForumTopicHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论