Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+28 -1
View File
@@ -11,7 +11,7 @@
namespace IPS\core\Warnings;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -172,4 +172,31 @@ class _Reason extends \IPS\Node\Model
return parent::delete();
}
/**
* Get output for API
*
* @param \IPS\Member|NULL $authorizedMember The member making the API request or NULL for API Key / client_credentials
* @return array
* @apiresponse int id ID number
* @apiresponse string name Warn reason name
* @apiresponse string defaultNotes Default notes for warning (moderator can override)
* @apiresponse int points The warning points levied with the warning
* @apiresponse bool pointsOverride Whether the moderator can override the default points or not
* @apiresponse bool removeOverride Whether the moderator can override when the points will be removed or not
* @apiresponse string|null removePoints Time frame as a date interval when points will automatically be removed, or null if points do not automatically remove
* @apiresponse bool pointsAutoRemove Whether points are automatically removed or not
*/
public function apiOutput( \IPS\Member $authorizedMember = NULL )
{
return array(
'id' => $this->id,
'name' => $this->_title,
'defaultNotes' => $this->notes,
'points' => (int) $this->points,
'pointsOverride' => (bool) $this->points_override,
'pointsAutoRemove' => ( $this->remove AND $this->remove == -1 ) ? FALSE : TRUE,
'removePoints' => ( $this->remove AND $this->remove != -1 ) ? 'P' . ( ( $this->remove_unit == 'h' ) ? 'T' : '' ) . $this->remove . mb_strtoupper( $this->remove_unit ) : NULL,
'removeOverride' => (bool) $this->remove_override
);
}
}