Version 4.7.23

This commit is contained in:
Neo committed 2025-12-19 16:21:27 -08:00
1 parent 7124a02564
commit 25ddeb65d6
1791 files changed
+76990 -44452

No files matched your search

+118 -39
View File
@@ -267,7 +267,7 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
catch( \Exception $e ) {}
}
if( \IPS\Application::appIsEnabled( 'cloud' ) and \IPS\cloud\Realtime::i()->isEnabled('trending') and $class::$includeInTrending )
if( \IPS\Application::appIsEnabled( 'cloud' ) and \IPS\cloud\Application::trendingIsEnabled() and $class::$includeInTrending )
{
try
{
@@ -373,7 +373,12 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
}
catch ( \BadMethodCallException $e ) { }
}
if( \IPS\Application::appIsEnabled( 'cloud' ) )
{
\IPS\Output::setCacheTime( \IPS\cloud\Application::getCacheDateForPage( $item->mapped('updated') ?: $item->mapped('date'), ( ( $item::$application === 'forums' and $item->isArchived() ) ? 'archived' : 'content' ) ) );
}
/* Return */
return $item;
}
@@ -737,6 +742,19 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
{
$item->setTags( $values[ $item::$formLangPrefix . 'tags' ] ?: array() );
/* Update the search index */
if ( $item instanceof \IPS\Content\Searchable )
{
if( $item::$firstCommentRequired )
{
\IPS\Content\Search\Index::i()->index( $item->firstComment() );
}
else
{
\IPS\Content\Search\Index::i()->index( $item );
}
}
if ( \IPS\Request::i()->isAjax() )
{
/* Build html we'll need to display */
@@ -804,7 +822,7 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
$maxLength = \IPS\Settings::i()->max_title_length ?: 255;
$titleField = $item::$databaseColumnMap['title'];
if( \strlen( \IPS\Request::i()->newTitle ) > $maxLength )
if( \mb_strlen( \IPS\Request::i()->newTitle ) > $maxLength )
{
throw new \LengthException( \IPS\Member::loggedIn()->language()->addToStack( 'form_maxlength', FALSE, array( 'pluralize' => array( $maxLength ) ) ) );
}
@@ -819,6 +837,11 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
{
throw new \InvalidArgumentException( \IPS\Member::loggedIn()->language()->addToStack( 'form_tags_not_allowed', FALSE, array( 'sprintf' => array( \IPS\Request::i()->newTitle ) ) ) );
}
/* Stop doing anything if the title wasn't changed */
if( $item->$titleField == $newTitle->value )
{
\IPS\Output::i()->json( $item->$titleField );
}
$item->$titleField = $newTitle->value;
$idField = $item::$databaseColumnId;
@@ -844,15 +867,20 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
if ( $item instanceof \IPS\Content\Searchable )
{
\IPS\Content\Search\Index::i()->index( $item );
}
/* Only add the mod log entry if we actually changed the title */
if( $item->$titleField !== $oldTitle )
{
\IPS\Session::i()->modLog( 'modlog__comment_edit_title', array( (string) $item->url() => FALSE, $item->$titleField => FALSE, $oldTitle => FALSE ), $item );
/* If it's an item which requires a first comment, send the comment */
if( $item::$firstCommentRequired )
{
$class = $item->firstComment();
}
else
{
$class = $item;
}
\IPS\Content\Search\Index::i()->index( $class );
}
\IPS\Session::i()->modLog( 'modlog__comment_edit_title', array( (string) $item->url() => FALSE, $item->$titleField => FALSE, $oldTitle => FALSE ), $item );
\IPS\Output::i()->json( $item->$titleField );
}
catch( \LogicException $e )
@@ -1378,17 +1406,27 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
return;
}
catch( \Exception $e ) { }
$options = array( \IPS\core\Reports\Report::TYPE_MESSAGE => \IPS\Member::loggedIn()->language()->addToStack('report_message_item') );
foreach( \IPS\core\Reports\Types::roots() as $type )
{
$options[ $type->id ] = $type->_title;
}
$form->add( new \IPS\Helpers\Form\Radio( 'report_type', NULL, FALSE, array( 'options' => $options ) ) );
}
$options = array( \IPS\core\Reports\Report::TYPE_MESSAGE => \IPS\Member::loggedIn()->language()->addToStack('report_message_item') );
foreach( \IPS\core\Reports\Types::roots() as $type )
{
$options[ $type->id ] = $type->_title;
}
if ( count( $options ) > 1 )
{
$form->add( new \IPS\Helpers\Form\Select( 'report_type', NULL, FALSE, ['options' => $options] ) );
}
$form->add( new \IPS\Helpers\Form\Editor( 'report_message', NULL, FALSE, array( 'app' => 'core', 'key' => 'Reports', 'autoSaveKey' => "report-{$class::$application}-{$class::$module}-{$item->$idColumn}", 'minimize' => \IPS\Request::i()->isAjax() ? 'report_message_placeholder' : NULL ) ) );
if ( ! \IPS\Member::loggedIn()->member_id and \IPS\Settings::i()->report_capture_guest_details )
{
/* Guest details */
$form->add( new \IPS\Helpers\Form\Text( 'report_guest_name', null, \IPS\Settings::i()->report_guest_details_name_mandatory ) );
$form->add( new \IPS\Helpers\Form\Email( 'report_guest_email', null, true ) );
}
$form->add( new \IPS\Helpers\Form\Editor( 'report_message', NULL, (bool) \IPS\Settings::i()->report_content_mandatory, array( 'app' => 'core', 'key' => 'Reports', 'autoSaveKey' => "report-{$class::$application}-{$class::$module}-{$item->$idColumn}", 'minimize' => \IPS\Settings::i()->report_content_mandatory ? 'report_message_placeholder_mandatory' : 'report_message_placeholder' ) ) );
if ( !\IPS\Request::i()->isAjax() )
{
\IPS\Member::loggedIn()->language()->words['report_message'] = \IPS\Member::loggedIn()->language()->addToStack('report_message_fallback');
@@ -1400,7 +1438,26 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
}
if ( $values = $form->values() )
{
$report = $item->report( $values['report_message'], ( isset( $values['report_type'] ) ) ? $values['report_type'] : 0 );
$guestDetails = [];
if ( ! \IPS\Member::loggedIn()->member_id and \IPS\Settings::i()->report_capture_guest_details )
{
$guestDetails = [ 'name' => $values['report_guest_name'], 'email' => $values['report_guest_email'] ];
/* Has this guest already reported this? */
try
{
$index = \IPS\Db::i()->select( '*', 'core_rc_index', [ 'class=? and content_id=?', \get_class( $item ), $item->$idColumn ] )->first();
$report = \IPS\Db::i()->select( '*', 'core_rc_reports', [ 'rid=? and guest_email=?', $index['id'], $values['report_guest_email'] ] )->first();
\IPS\Output::i()->error( 'report_err_already_reported', '2S136/11', 403, '' );
}
catch( \UnderflowException )
{
/* The query failed, so this is a new report */
}
}
$report = $item->report( $values['report_message'], ( isset( $values['report_type'] ) ) ? $values['report_type'] : 0, null, $guestDetails );
\IPS\File::claimAttachments( "report-{$class::$application}-{$class::$module}-{$item->$idColumn}", $report->id );
if ( \IPS\Request::i()->isAjax() )
{
@@ -3154,7 +3211,7 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
}
/* Show form */
$form = new \IPS\Helpers\Form( NULL, 'report_submit' );
$form = new \IPS\Helpers\Form( 'report_submit', 'report_submit' );
$form->class = 'ipsForm_vertical';
$itemIdColumn = $class::$databaseColumnId;
$idColumn = $comment::$databaseColumnId;
@@ -3172,17 +3229,27 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
return;
}
catch( \Exception $e ) { }
$options = array( \IPS\core\Reports\Report::TYPE_MESSAGE => \IPS\Member::loggedIn()->language()->addToStack('report_message_comment') );
foreach( \IPS\core\Reports\Types::roots() as $type )
{
$options[ $type->id ] = $type->_title;
}
$form->add( new \IPS\Helpers\Form\Radio( 'report_type', NULL, FALSE, array( 'options' => $options ) ) );
}
$form->add( new \IPS\Helpers\Form\Editor( 'report_message', NULL, FALSE, array( 'app' => 'core', 'key' => 'Reports', 'autoSaveKey' => "report-{$class::$application}-{$class::$module}-{$item->$itemIdColumn}-{$comment->$idColumn}", 'minimize' => 'report_message_placeholder' ) ) );
$options = array( \IPS\core\Reports\Report::TYPE_MESSAGE => \IPS\Member::loggedIn()->language()->addToStack('report_message_comment') );
foreach( \IPS\core\Reports\Types::roots() as $type )
{
$options[ $type->id ] = $type->_title;
}
if ( count( $options ) > 1 )
{
$form->add( new \IPS\Helpers\Form\Select( 'report_type', null, false, ['options' => $options] ) );
}
if ( ! \IPS\Member::loggedIn()->member_id and \IPS\Settings::i()->report_capture_guest_details )
{
/* Guest details */
$form->add( new \IPS\Helpers\Form\Text( 'report_guest_name', null, \IPS\Settings::i()->report_guest_details_name_mandatory ) );
$form->add( new \IPS\Helpers\Form\Email( 'report_guest_email', null, true ) );
}
$form->add( new \IPS\Helpers\Form\Editor( 'report_message', null, (bool) \IPS\Settings::i()->report_content_mandatory, array( 'app' => 'core', 'key' => 'Reports', 'autoSaveKey' => "report-{$class::$application}-{$class::$module}-{$item->$itemIdColumn}-{$comment->$idColumn}", 'minimize' => \IPS\Settings::i()->report_content_mandatory ? 'report_message_placeholder_mandatory' : 'report_message_placeholder' ) ) );
if ( !\IPS\Request::i()->isAjax() )
{
\IPS\Member::loggedIn()->language()->words['report_message'] = \IPS\Member::loggedIn()->language()->addToStack('report_message_fallback');
@@ -3195,7 +3262,26 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
if ( $values = $form->values() )
{
$report = $comment->report( $values['report_message'], ( isset( $values['report_type'] ) ) ? $values['report_type'] : 0 );
$guestDetails = [];
if ( ! \IPS\Member::loggedIn()->member_id and \IPS\Settings::i()->report_capture_guest_details )
{
$guestDetails = [ 'name' => $values['report_guest_name'], 'email' => $values['report_guest_email'] ];
/* Has this guest already reported this? */
try
{
$index = \IPS\Db::i()->select( '*', 'core_rc_index', [ 'class=? and content_id=?', \get_class( $comment ), $comment->$idColumn ] )->first();
$report = \IPS\Db::i()->select( '*', 'core_rc_reports', [ 'rid=? and guest_email=?', $index['id'], $values['report_guest_email'] ] )->first();
\IPS\Output::i()->error( 'report_err_already_reported', '2S136/11', 403, '' );
}
catch( \UnderflowException )
{
/* The query failed, so this is a new report */
}
}
$report = $comment->report( $values['report_message'], ( isset( $values['report_type'] ) ) ? $values['report_type'] : 0, null, $guestDetails );
\IPS\File::claimAttachments( "report-{$class::$application}-{$class::$module}-{$item->$itemIdColumn}-{$comment->$idColumn}", $report->id );
if ( \IPS\Request::i()->isAjax() )
{
@@ -3671,13 +3757,6 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
$item->rebuildFirstAndLastCommentData();
$oldItem->rebuildFirstAndLastCommentData();
/* Update popular data */
if( method_exists( $item, 'rebuildPopularTime' ) )
{
$item->rebuildPopularTime();
$oldItem->rebuildPopularTime();
}
/* Option to do some post split stuff */
if ( method_exists( $item, 'splitComplete' ) )
{