Version 4.6.0

This commit is contained in:
Neo committed 2025-12-19 05:55:31 -08:00
1 parent f79dcf067a
commit 517a5e1f70
2036 files changed
+110041 -26162

No files matched your search

+47 -13
View File
@@ -247,7 +247,6 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
default:
return $club->canRead( $member );
}
}
if ( $this->social_group )
@@ -312,7 +311,7 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
{
if ( $club->type == $club::TYPE_PUBLIC or $club->type == $club::TYPE_READONLY or $club->type == $club::TYPE_OPEN)
{
return 'ca';
return '*';
}
else
{
@@ -429,6 +428,10 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
'subnodes' => FALSE,
), NULL, NULL, NULL, 'blog_category_id' ) );
}
else
{
$form->hiddenValues['blog_category_id'] = \IPS\Request::i()->parent;
}
$groups = array();
foreach ( \IPS\Member\Group::groups() as $k => $v )
@@ -461,7 +464,7 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
},
NULL, NULL, 'blog_member_id' ) );
$form->add( new \IPS\Helpers\Form\Select( 'blog_groupblog_ids', $this->id ? explode( ',', $this->groupblog_ids ) : array(), FALSE, array( 'options' => $groups, 'multiple' => TRUE ), NULL, NULL, NULL, 'blog_groupblog_ids' ) );
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'blog_groupblog_ids', $this->id ? explode( ',', $this->groupblog_ids ) : array(), FALSE, array( 'options' => $groups, 'multiple' => TRUE ), NULL, NULL, NULL, 'blog_groupblog_ids' ) );
$form->add( new \IPS\Helpers\Form\Translatable( 'blog_groupblog_name', NULL, FALSE, array( 'app' => 'blog', 'key' => ( $this->id ? "blogs_groupblog_name_{$this->id}" : NULL ) ), function( $value ) {
if ( \IPS\Request::i()->blog_type === 'group' )
{
@@ -542,6 +545,8 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
$form->add( new \IPS\Helpers\Form\YesNo( 'blog_enable_rss', $this->id ? $this->settings['allowrss'] : TRUE ) );
}
$form->add( new \IPS\Helpers\Form\YesNo( 'allow_anonymous_comments', $this->id ? $this->allow_anonymous : FALSE, FALSE, array() ) );
/* Categories */
if ( $public and $this->id )
{
@@ -558,8 +563,7 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
*/
public function formatFormValues( $values )
{
if ( isset( $values['blog_category_id'] ) and $values[ 'blog_category_id' ] )
if ( isset( $values['blog_category_id'] ) and \is_object( $values[ 'blog_category_id' ] ) )
{
$values[ 'blog_category_id' ] = \intval( $values[ 'blog_category_id' ]->id );
}
@@ -589,6 +593,12 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
unset( $values['blog_type'] );
}
if( isset( $values['allow_anonymous_comments'] ) )
{
$values['allow_anonymous'] = ( $values['allow_anonymous_comments'] ? 2 : 0 );
unset( $values['allow_anonymous_comments'] );
}
$this->massUpdateIndex = FALSE;
if ( isset( $values['blog_privacy'] ) and $values['blog_privacy'] === 'private' )
{
@@ -622,7 +632,7 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
if( $values['blog_member_id'] )
{
\IPS\File::claimAttachments( 'blogs-new-blog', $this->id, NULL, 'description', TRUE );
\IPS\File::claimAttachments( 'blogs-new-blog', $this->id, NULL, 'description' );
}
else
{
@@ -766,6 +776,12 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
{
\IPS\Content\Search\Index::i()->massUpdate( 'IPS\blog\Entry', $this->id, NULL, $this->searchIndexPermissions() );
}
/* If this was a new blog, fire the webhook */
if ( $this->newBlog )
{
\IPS\Api\Webhook::fire( 'blogBlog_create', $this, $this->webhookFilters() );
}
}
/**
@@ -1096,6 +1112,11 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
{
return array( \IPS\Theme::i()->getTemplate( 'browse', 'blog' ), 'rows' );
}
/**
* @brief Remember if this is a new blog so we can fire the webhook if so
*/
protected $newBlog = NULL;
/**
* Save Changed Columns
@@ -1104,14 +1125,12 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
*/
public function save()
{
$new = $this->_new;
if( $this->newBlog === NULL )
{
$this->newBlog = $this->_new;
}
parent::save();
if ( $new )
{
\IPS\Api\Webhook::fire( 'blogBlog_create', $this, $this->webhookFilters() );
}
}
/**
@@ -1150,6 +1169,9 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
/* Delete Follows */
\IPS\Db::i()->delete( 'core_follow', array( "follow_app=? AND follow_area=? AND follow_rel_id=?", 'blog', 'blog', $this->_id ) );
/* Delete Entry categories */
\IPS\Db::i()->delete( 'blog_entry_categories', array( "entry_category_blog_id = ?", $this->_id ) );
return parent::delete();
}
@@ -1285,6 +1307,9 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
*/
public function clubForm( \IPS\Helpers\Form $form )
{
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_view.js', 'blog', 'front' ) );
$form->addTab( 'blog_settings' );
$itemClass = static::$contentItemClass;
$form->add( new \IPS\Helpers\Form\Text( 'club_node_name', $this->_id ? $this->_title : \IPS\Member::loggedIn()->language()->addToStack( 'blogs_sg' ), TRUE, array( 'maxLength' => 255 ) ) );
$form->add( new \IPS\Helpers\Form\Editor( 'club_node_description', $this->_id ? \IPS\Member::loggedIn()->language()->get( static::$titleLangPrefix . $this->_id . '_desc' ) : NULL, FALSE, array( 'app' => 'blog', 'key' => 'Blogs', 'autoSaveKey' => ( $this->id ? "blogs-blog-{$this->id}" : "blogs-new-blog" ), 'attachIds' => $this->id ? array( $this->id, NULL, 'description' ) : NULL, 'minimize' => 'blog_desc_placeholder' ) ) );
@@ -1292,6 +1317,14 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
{
$form->add( new \IPS\Helpers\Form\YesNo( 'blog_enable_rss', $this->id ? $this->settings['allowrss'] : TRUE ) );
}
/* Categories */
if ( $this->id )
{
$form->addTab( 'blog_entry_categories' );
$form->addHtml( \IPS\Theme::i()->getTemplate( 'view', 'blog', 'front' )->manageCategories( $this ) );
}
}
/**
@@ -1392,9 +1425,10 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
* Get last comment time
*
* @note This should return the last comment time for this node only, not for children nodes
* @param \IPS\Member|NULL $member MemberObject
* @return \IPS\DateTime|NULL
*/
public function getLastCommentTime()
public function getLastCommentTime( \IPS\Member $member = NULL )
{
return $this->last_edate ? \IPS\DateTime::ts( $this->last_edate ) : NULL;
}