Version 4.7.8
This commit is contained in:
1 parent
7b7404e741
commit
fd22d99e69
688 files changed
+19814
-10890
No files matched your search
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @brief LiveTopic Trait
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 17 Nov 2022
|
||||
*/
|
||||
|
||||
namespace IPS\forums\Topic;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* LiveTopic Trait
|
||||
*
|
||||
* This carries specific functionality for LiveTopic and forum topic interactions
|
||||
* @todo consider moving into cloud but would be tricky given you cannot hook into traits and methods will need to be exposed to normal forum logic.
|
||||
*/
|
||||
trait LiveTopic
|
||||
{
|
||||
/**
|
||||
* Return the live topic, or null if one doesn't exist / customer not on cloud
|
||||
*
|
||||
* @return \IPS\cloud\LiveTopic|null
|
||||
*/
|
||||
public function getLiveTopic(): ?\IPS\cloud\LiveTopic
|
||||
{
|
||||
if ( \IPS\Application::appIsEnabled( 'cloud' ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
return \IPS\cloud\LiveTopic::load( $this->tid, 'topic_topic_id' );
|
||||
}
|
||||
catch ( \OutOfRangeException )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -120,11 +120,6 @@ class _Post extends \IPS\Content\Comment implements \IPS\Content\EditHistory, \I
|
||||
*/
|
||||
public static $tabParameter = NULL; /* We do not want ?tab=comments appended to links in from findComment links */
|
||||
|
||||
/**
|
||||
* @brief Whether to track the sentiment scores in cloud_sentiment_scores for this content
|
||||
*/
|
||||
public $trackSentimentScore = true;
|
||||
|
||||
/**
|
||||
* Create comment
|
||||
*
|
||||
|
||||
@@ -37,7 +37,7 @@ class _Topic extends \IPS\Content\Item implements
|
||||
\IPS\Content\Anonymous,
|
||||
\IPS\Content\FuturePublishing
|
||||
{
|
||||
use \IPS\Content\Reactable, \IPS\Content\Reportable, \IPS\Content\Statistics, \IPS\Content\Solvable { toggleSolveComment as protected _toggleSolveComment; }
|
||||
use \IPS\forums\Topic\LiveTopic, \IPS\Content\Reactable, \IPS\Content\Reportable, \IPS\Content\Statistics, \IPS\Content\Solvable { toggleSolveComment as protected _toggleSolveComment; }
|
||||
|
||||
/**
|
||||
* @brief Not archived
|
||||
@@ -177,11 +177,6 @@ class _Topic extends \IPS\Content\Item implements
|
||||
* @brief Setting name for show_meta
|
||||
*/
|
||||
public static $showMetaSettingKey = 'forums_topics_show_meta';
|
||||
|
||||
/**
|
||||
* @brief Whether to track the sentiment scores in cloud_sentiment_scores for this content
|
||||
*/
|
||||
public $trackSentimentScore = true;
|
||||
|
||||
/**
|
||||
* Callback from \IPS\Http\Url\Inernal::correctUrlFromVerifyClass()
|
||||
@@ -565,26 +560,20 @@ class _Topic extends \IPS\Content\Item implements
|
||||
|
||||
if ( static::modPermission( 'lock', NULL, $container ) )
|
||||
{
|
||||
/* Poll always needs to go on the end */
|
||||
$poll = NULL;
|
||||
if ( isset( $formElements['poll'] ) )
|
||||
{
|
||||
$poll = $formElements['poll'];
|
||||
unset( $formElements['poll'] );
|
||||
}
|
||||
|
||||
/* Add lock/unlock options */
|
||||
if ( static::modPermission( 'unlock', NULL, $container ) )
|
||||
{
|
||||
$formElements['topic_open_time'] = new \IPS\Helpers\Form\Date( 'topic_open_time', ( $item and $item->topic_open_time ) ? \IPS\DateTime::ts( $item->topic_open_time ) : NULL, FALSE, array( 'time' => TRUE ) );
|
||||
}
|
||||
$formElements['topic_close_time'] = new \IPS\Helpers\Form\Date( 'topic_close_time', ( $item and $item->topic_close_time ) ? \IPS\DateTime::ts( $item->topic_close_time ) : NULL, FALSE, array( 'time' => TRUE ) );
|
||||
|
||||
/* Poll always needs to go on the end */
|
||||
if ( $poll )
|
||||
{
|
||||
$formElements['poll'] = $poll;
|
||||
}
|
||||
}
|
||||
|
||||
/* Poll always needs to go on the end */
|
||||
if ( isset( $formElements['poll'] ) )
|
||||
{
|
||||
$poll = $formElements['poll'];
|
||||
unset( $formElements['poll'] );
|
||||
$formElements['poll'] = $poll;
|
||||
}
|
||||
|
||||
return $formElements;
|
||||
@@ -1118,7 +1107,7 @@ class _Topic extends \IPS\Content\Item implements
|
||||
\IPS\Db::i()->delete( 'forums_answer_ratings', "topic IN(" . implode( ',', $itemTids ) . ")" );
|
||||
|
||||
/* And then update the topic with the new question rating count */
|
||||
\IPS\Db::i()->update( 'forums_topics', array( 'question_rating' =>
|
||||
\IPS\Db::i()->update( 'forums_topics', array( 'question_rating' =>
|
||||
\IPS\Db::i()->select( 'SUM(rating)', 'forums_question_ratings', array( 'topic=?', $this->tid ) )
|
||||
), array( 'tid=?', $this->tid ) );
|
||||
|
||||
|
||||
Reference in new issue
Block a user