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

@@ -825,7 +825,7 @@ class _Category 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' ) ) ) );
}
}
@@ -902,4 +902,41 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
break;
}
}
/**
* Get the member's view method
*
* @return string
*/
public static function getMemberView()
{
$method = ( isset( \IPS\Request::i()->cookie['idm_category_view'] ) ) ? \IPS\Request::i()->cookie['idm_category_view'] : NULL;
$chooseable = \IPS\Settings::i()->idm_default_view_choose;
if ( ! $chooseable or !\IPS\Member::loggedIn()->member_id )
{
return \IPS\Settings::i()->idm_default_view;
}
if ( ! $method )
{
try
{
$method = \IPS\Db::i()->select( 'method', 'downloads_view_method', array( 'member_id=?', \IPS\Member::loggedIn()->member_id ) )->first();
}
catch( \UnderFlowException $e )
{
$method = \IPS\Settings::i()->idm_default_view;
}
/* Attempt to set the cookie again */
\IPS\Request::i()->setCookie( 'idm_category_view', $method, ( new \IPS\DateTime )->add( new \DateInterval( 'P1Y' ) ) );
}
if ( ! $method or !$chooseable )
{
$method = \IPS\Settings::i()->idm_default_view;
}
return $method;
}
}
@@ -122,7 +122,7 @@ class _Field extends \IPS\CustomField
unset( $form->elements['']['pf_search_type'] );
\IPS\Member::loggedIn()->language()->words['pfield_displayoptions'] = \IPS\Member::loggedIn()->language()->addToStack('field_displayoptions');
\IPS\Member::loggedIn()->language()->words['field_displayoptions'] = \IPS\Member::loggedIn()->language()->addToStack('pfield_displayoptions');
$form->add( new \IPS\Helpers\Form\Radio( 'downloads_field_location', $this->id ? $this->display_location : 'below', FALSE, array( 'options' => array( 'sidebar' => 'idm_cfield_sidebar', 'below' => 'idm_cfield_below', 'tab' => 'idm_cfield_tab' ) ), NULL, NULL, NULL, 'idm_field_location' ) );
@@ -152,7 +152,7 @@ class _Field extends \IPS\CustomField
if ( \IPS\Application::appIsEnabled( 'forums' ) AND isset( $values['cf_topic'] ) )
{
/* Forcibly disable include in topic option if it is a paid field */
$values['topic'] = ( isset( $values['downloads_field_paid'] ) AND $values['downloads_field_paid'] ) ? $values['cf_topic'] : 0;
$values['topic'] = ( isset( $values['downloads_field_paid'] ) AND $values['downloads_field_paid'] ) ? 0 : $values['cf_topic'];
unset( $values['cf_topic'] );
}
@@ -81,11 +81,6 @@ class _Comment extends \IPS\Content\Comment implements \IPS\Content\EditHistory,
* @brief [Content] Key for hide reasons
*/
public static $hideLogKey = 'downloads-files';
/**
* @brief Whether to track the sentiment scores in cloud_sentiment_scores for this content
*/
public $trackSentimentScore = true;
/**
* Get URL for doing stuff
+24 -1
View File
@@ -113,7 +113,8 @@ class _File extends \IPS\Content\Item implements
'edit_member_name' => 'edit_name',
'edit_show' => 'append_edit',
'edit_reason' => 'edit_reason',
'is_anon' => 'is_anon'
'is_anon' => 'is_anon',
'last_comment_anon' => 'last_comment_anon'
);
/**
@@ -2416,6 +2417,7 @@ class _File extends \IPS\Content\Item implements
$this->_primaryScreenshotThumb = FALSE;
$this->syncTopic();
}
\IPS\Api\Webhook::fire( 'downloads_new_version', array( $this ) );
}
/* !Embeddable */
@@ -2740,4 +2742,25 @@ class _File extends \IPS\Content\Item implements
return parent::modAction( $action, $member, $reason, $immediately );
}
/**
* Can the member delete the pending version
*
* @param \IPS\Member|NULL $member
* @return bool
*/
public function canDeletePendingVersion( \IPS\Member $member = NULL): bool
{
if( !$this->hasPendingVersion() )
{
return FALSE;
}
if( $this->canEdit($member) )
{
return TRUE;
}
return FALSE;
}
}
@@ -109,6 +109,29 @@ class _PendingVersion extends \IPS\Content\Item implements \IPS\Content\Hideable
{
return FALSE;
}
/**
* Can delete pending version?
*
* @param \IPS\Member|NULL $member The member to check for (NULL for currently logged in member)
* @return bool
*/
public function canDelete( $member=NULL )
{
$member = $member ?: \IPS\Member::loggedIn();
if( !$member->member_id )
{
return FALSE;
}
if( !$this->author()->member_id == $member->member_id AND !$this->file()->canDeletePendingVersion( $member ) )
{
return FALSE;
}
return TRUE;
}
/**
* Returns the content
@@ -288,6 +311,7 @@ class _PendingVersion extends \IPS\Content\Item implements \IPS\Content\Hideable
{
/* Moderator log */
\IPS\Session::i()->modLog( 'modlog__action_newversion_approved', array( (string) $this->file()->url() => FALSE, $this->file()->name => FALSE ), $this->file() );
\IPS\Api\Webhook::fire( 'downloads_new_version_approved', $this );
}
return parent::modAction( $action, $member, $reason, $immediately );
@@ -85,11 +85,6 @@ class _Review extends \IPS\Content\Review implements \IPS\Content\EditHistory, \
* @brief [Content] Key for hide reasons
*/
public static $hideLogKey = 'downloads-files-rev';
/**
* @brief Whether to track the sentiment scores in cloud_sentiment_scores for this content
*/
public $trackSentimentScore = true;
/**
* Get URL for doing stuff