Version 5.0.0 beta 7

This commit is contained in:
Neo committed 2025-12-19 17:18:38 -08:00
1 parent fa2a720105
commit 54d5dcd0a0
156 files changed
+4337 -2995

No files matched your search

+40
View File
@@ -16,12 +16,14 @@ use BadMethodCallException;
use Exception;
use InvalidArgumentException;
use IPS\Api\Webhook;
use IPS\Content\Anonymous;
use IPS\Content\Assignable;
use IPS\Content\Comment;
use IPS\Content\Followable;
use IPS\Content\Hideable;
use IPS\Content\Item;
use IPS\Content\Review;
use IPS\Content\Solvable;
use IPS\core\Approval;
use IPS\core\Reports\Report;
use IPS\Db\Select;
@@ -1954,4 +1956,42 @@ abstract class Content extends ActiveRecord
{
return Bridge::i()->canUnmarkAsSpam( $member, $content );
}
/**
* Get a url from which to load the mini-profile bar.
*
* @return string
*/
public function get_authorMiniProfileUrl() : string
{
$params = [
'app' => 'core',
'module' => 'system',
'controller' => 'ajax',
'do' => 'miniProfile',
'authorId' => $this->author()?->member_id ?? null,
];
if ( !IPS::classUsesTrait( $this, Anonymous::class ) or $this->isAnonymous() )
{
$params['anonymous'] = '1';
}
$item = $this instanceof Comment ? $this->item() : $this;
if ( IPS::classUsesTrait( $item, Solvable::class ) )
{
if ( isset( $this->author_solved_count ) and is_int( $this->author_solved_count ) )
{
$params['solvedCount'] = $this->author_solved_count;
}
else
{
$params['solvedCount'] = 'load';
}
}
$url = Url::internal( '', 'front' )->setQueryString( $params );
return (string) $url;
}
}
+3 -11
View File
@@ -12,6 +12,7 @@ namespace IPS\Content;
/* To prevent PHP errors (extending class does not exist) revealing path */
use BadMethodCallException;
use Exception;
use IPS\Application;
use IPS\Content\Search\Index;
@@ -21,7 +22,6 @@ use IPS\forums\Topic;
use IPS\forums\Topic\Post;
use IPS\IPS;
use IPS\Member;
use IPS\Settings;
use OutOfRangeException;
use function defined;
@@ -93,10 +93,6 @@ trait ItemTopic
$title = $this->getTopicTitle();
Member::loggedIn()->language()->parseOutputForDisplay( $title );
$topic->title = $title;
if ( Settings::i()->tags_enabled )
{
$topic->setTags( $this->prefix() ? array_merge( $this->tags(), array( 'prefix' => $this->prefix() ) ) : $this->tags() );
}
$topic->save();
$firstPost = $topic->comments( 1 );
@@ -143,14 +139,10 @@ trait ItemTopic
{
$topic->setAnonymous( TRUE, $this->author );
}
catch( \BadMethodCallException ){}
catch( BadMethodCallException ){}
}
$topic->markRead( $this->author() );
if ( Settings::i()->tags_enabled )
{
$topic->setTags( $this->prefix() ? array_merge( $this->tags(), array( 'prefix' => $this->prefix() ) ) : $this->tags() );
}
/* Create post */
$content = $this->getTopicContent();
@@ -163,7 +155,7 @@ trait ItemTopic
{
$post->setAnonymous( TRUE, $this->author );
}
catch( \BadMethodCallException ){}
catch( BadMethodCallException ){}
}
$topic->topic_firstpost = $post->pid;
+19
View File
@@ -19,6 +19,7 @@ use Exception;
use InvalidArgumentException;
use IPS\Application;
use IPS\Content;
use IPS\core\FrontNavigation;
use IPS\Data\Store;
use IPS\DateTime;
use IPS\Db;
@@ -654,6 +655,24 @@ class Tag extends Model
$photo->delete();
}
/* Delete any navigation items that reference this tag */
foreach( Db::i()->select( '*', 'core_menu', [ 'app=? and extension=?', 'core', 'Tags' ] ) as $row )
{
if( $row['config'] and $config = json_decode( $row['config'], true ) )
{
if( $config['id'] == $this->id )
{
Db::i()->delete( 'core_menu', [ 'id=?', $row['id'] ] );
}
}
}
try
{
unset( Store::i()->frontNavigation );
}
catch( OutOfRangeException ){}
/* Queue the background task to remove the tag from all currently tagged items */
Task::queue( 'core', 'UpdateTaggedItems', [ 'tag' => $this->text, 'delete' => true ], 5, [ 'tag' ] );
}