Version 4.7.8

This commit is contained in:
Neo committed 2025-12-19 16:10:42 -08:00
1 parent 7b7404e741
commit fd22d99e69
688 files changed
+19814 -10890

No files matched your search

+14 -6
View File
@@ -347,7 +347,7 @@ class _Forum extends \IPS\Node\Model implements \IPS\Node\Permissions
* We also cannot look for future entries since this code is used in older upgrades, but we can look for the date instead.
*/
$select = \IPS\Db::i()->select( '*', 'forums_topics', array( "forums_topics.forum_id=? AND forums_topics.approved=1 AND forums_topics.state != ? AND forums_topics.last_post<=?", $this->id, 'link', time() ), 'forums_topics.last_post DESC', 1, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER )->first();
$select = \IPS\Db::i()->select( '*', 'forums_topics', array( "forums_topics.forum_id=? AND forums_topics.approved=1 AND forums_topics.state != ? AND forums_topics.last_post<=? AND forums_topics.publish_date <=?", $this->id, 'link', time(), time() ), 'forums_topics.last_post DESC', 1, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER )->first();
$topic = \IPS\forums\Topic::constructFromData( $select );
@@ -1205,7 +1205,7 @@ class _Forum extends \IPS\Node\Model implements \IPS\Node\Permissions
if( isset( $values[ $k ] ) )
{
/* If were disabling bw_enable_answers_moderator for discussion forums, we need to make sure bw_enable_answers_member is also disabled */
if ( $k == 'bw_enable_answers_moderator' AND !$values[ $k ] )
if ( $values['forum_type'] == 'normal' AND $k == 'bw_enable_answers_moderator' AND !$values[ $k ] )
{
$values['forums_bitoptions']['bw_enable_answers_moderator'] = FALSE;
$values['forums_bitoptions']['bw_enable_answers_member'] = FALSE;
@@ -1569,7 +1569,7 @@ class _Forum extends \IPS\Node\Model implements \IPS\Node\Permissions
if ( $moderator['perms'] === '*' OR
(
!empty( $json['can_read_all_topics'] ) AND ( isset( $json['forums'] ) AND ( $json['forums'] === -1 OR \in_array( $this->_id, $json['forums'] ) ) )
!empty( $json['can_read_all_topics'] ) AND ( !empty( $json['forums'] ) AND ( $json['forums'] === -1 OR \in_array( $this->_id, $json['forums'] ) ) )
) )
{
if( $moderator['type'] === 'g' )
@@ -1885,9 +1885,17 @@ class _Forum extends \IPS\Node\Model implements \IPS\Node\Permissions
$return['permissions'] = $this->permissions();
}
if ( \IPS\IPS::classUsesTrait( \get_called_class(), 'IPS\Content\ClubContainer' ) AND $this->club() )
if ( \IPS\IPS::classUsesTrait( \get_called_class(), 'IPS\Content\ClubContainer' ) )
{
$return['public'] = ( $this->isPublic() ) ? 1 : 0;
if( $this->club() )
{
$return['public'] = ( $this->isPublic() ) ? 1 : 0;
$return['club'] = $this->club()->apiOutput( $authorizedMember );
}
else
{
$return['club'] = 0;
}
}
return $return;
@@ -1947,7 +1955,7 @@ class _Forum extends \IPS\Node\Model implements \IPS\Node\Permissions
if( $club->type == 'closed' )
{
$form->add( new \IPS\Helpers\Form\YesNo( 'club_node_public', $this->id ? $this->isPublic() : FALSE ) );
$form->add( new \IPS\Helpers\Form\Radio( 'club_node_public', $this->id ? $this->isPublic() : 0, TRUE, array( 'options' => array( '0' => 'club_node_public_no', '1' => 'club_node_public_view', '2' => 'club_node_public_participate' ) ) ) );
}
}
@@ -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
*
+10 -21
View File
@@ -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 ) );