Version 4.3.0

This commit is contained in:
Neo committed 2025-12-19 05:47:12 -08:00
1 parent 96997ddd8e
commit fe1acf984a
1349 files changed
+116159 -67711

No files matched your search

+30 -2
View File
@@ -88,6 +88,7 @@ class _Warning extends \IPS\Content\Item
}
/* Undo the actions */
$consequences = array();
foreach ( array( 'mq' => 'mod_posts', 'rpa' => 'restrict_post', 'suspend' => 'temp_ban' ) as $w => $m )
{
if ( $this->$w and ( $this->$w < time() or $this->$w == -1 ) )
@@ -96,16 +97,21 @@ class _Warning extends \IPS\Content\Item
{
$latest = \IPS\Db::i()->select( '*', 'core_members_warn_logs', array( "wl_member=? AND wl_{$w}<>0 AND wl_id !=?", $member->member_id, $this->id ), 'wl_date DESC' )->first();
$member->$m = $latest[ 'wl_' . $w ];
$consequences[ $m ] = $latest['wl_id'];
}
catch ( \UnderflowException $e )
{
$member->$m = 0;
$consequences[ $m ] = 0;
}
}
}
/* Save */
$member->save();
/* Log */
$member->logHistory( 'core', 'warning', array( 'type' => 'revoke', 'wid' => $this->id, 'reason' => $this->reason, 'points' => $this->points, 'consequences' => $consequences ) );
}
/**
@@ -326,6 +332,13 @@ class _Warning extends \IPS\Content\Item
}
}, \IPS\Member::loggedIn()->language()->addToStack('until'), NULL, NULL, 'warn_suspend' );
$member = \IPS\Member::load( \IPS\Request::i()->id );
if( $member->temp_ban OR $member->mod_posts OR $member->restrict_post )
{
$elements[] = \IPS\Member::loggedIn()->language()->addToStack('member_existing_penalties', TRUE, array( 'sprintf' => $member->name ) );
}
/* Return */
return $elements;
@@ -340,6 +353,12 @@ class _Warning extends \IPS\Content\Item
protected function processBeforeCreate( $values )
{
$this->member = \IPS\Request::i()->member;
/* Permission Check */
if ( !\IPS\Member::loggedIn()->canWarn( \IPS\Member::load( $this->member ) ) )
{
\IPS\Output::i()->error( 'no_module_permission', '2C150/3', 403, '' );
}
foreach( $values['warn_punishment'] AS $p )
{
@@ -465,8 +484,15 @@ class _Warning extends \IPS\Content\Item
$this->content_module = isset( $ref['module'] ) ? $ref['module'] : NULL;
$this->content_id1 = isset( $ref['id_1'] ) ? $ref['id_1'] : NULL;
$this->content_id2 = isset( $ref['id_2'] ) ? $ref['id_2'] : NULL;
if ( $content = $this->content() and !$content->canView() )
{
$this->content_app = NULL;
$this->content_module = NULL;
$this->content_id1 = NULL;
$this->content_id2 = NULL;
}
/* Work out the timeframes for the penalities */
/* Work out the timeframes for the penalties */
if ( count( $values['warn_punishment'] ) )
{
foreach ( array( 'mq', 'rpa', 'suspend' ) as $f )
@@ -529,10 +555,12 @@ class _Warning extends \IPS\Content\Item
{
$member->warn_level += $this->points;
}
$consequences = array();
foreach ( array( 'mq' => 'mod_posts', 'rpa' => 'restrict_post', 'suspend' => 'temp_ban' ) as $k => $v )
{
if ( $this->$k )
{
$consequences[ $v ] = $this->$k;
if ( $this->$k != -1 )
{
$member->$v = \IPS\DateTime::create()->add( new \DateInterval( $this->$k ) )->getTimestamp();
@@ -545,7 +573,7 @@ class _Warning extends \IPS\Content\Item
}
$member->members_bitoptions['unacknowledged_warnings'] = (bool) \IPS\Settings::i()->warnings_acknowledge;
$member->save();
$member->logHistory( 'core', 'warning', array( 'wid' => $this->id ) );
$member->logHistory( 'core', 'warning', array( 'wid' => $this->id, 'points' => $this->points, 'reason' => $this->reason, 'consequences' => $consequences ) );
parent::processAfterCreate( $comment, $values );
}