Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

+26 -31
View File
@@ -11,46 +11,52 @@
namespace IPS\core\Reports;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use IPS\Content\Comment as ContentComment;
use IPS\Http\Url;
use IPS\Member;
use function defined;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* Report Comment Model
*/
class _Comment extends \IPS\Content\Comment
class Comment extends ContentComment
{
/**
* @brief [ActiveRecord] Database Table
*/
public static $databaseTable = 'core_rc_comments';
public static ?string $databaseTable = 'core_rc_comments';
/**
* @brief [ActiveRecord] Database Prefix
*/
public static $databasePrefix = '';
public static string $databasePrefix = '';
/**
* @brief [ActiveRecord] Multiton Store
*/
protected static $multitons;
protected static array $multitons;
/**
* @brief [Content\Comment] Item Class
*/
public static $itemClass = 'IPS\core\Reports\Report';
public static string $itemClass = 'IPS\core\Reports\Report';
/**
* @brief Application
*/
public static $application = 'core';
public static string $application = 'core';
/**
* @brief [Content\Comment] Database Column Map
*/
public static $databaseColumnMap = array(
public static array $databaseColumnMap = array(
'item' => 'rid',
'date' => 'comment_date',
'content' => 'comment',
@@ -62,15 +68,15 @@ class _Comment extends \IPS\Content\Comment
/**
* @brief Title
*/
public static $title = 'report_comment';
public static string $title = 'report_comment';
/**
* Get mapped value
*
* @param string $key date,content,ip_address,first
* @param string $key date,content,ip_address,first
* @return mixed
*/
public function mapped( $key )
public function mapped( string $key ): mixed
{
/* Get the reported content items title */
if ( $key === 'title' )
@@ -84,16 +90,16 @@ class _Comment extends \IPS\Content\Comment
/**
* Can view this entry
*
* @param \IPS\Member|NULL $member The member or NULL for currently logged in member.
* @param Member|NULL $member The member or NULL for currently logged in member.
* @return bool
*/
public function canView( $member = NULL )
public function canView( Member|null $member = null ): bool
{
$member = $member ?: \IPS\Member::loggedIn();
$member = $member ?: Member::loggedIn();
$return = parent::canView($member);
$return = parent::canView( $member );
if ( $return AND $member->modPermission('can_view_reports') )
if( $return AND $this->item()->canView( $member ) )
{
return TRUE;
}
@@ -104,9 +110,9 @@ class _Comment extends \IPS\Content\Comment
* Get URL for doing stuff
*
* @param string|NULL $action Action
* @return \IPS\Http\Url
* @return Url
*/
public function url( $action='find' )
public function url( ?string $action='find' ): Url
{
$url = parent::url( $action );
$idColumn = static::$databaseColumnId;
@@ -121,16 +127,5 @@ class _Comment extends \IPS\Content\Comment
/**
* @brief Value to set for the 'tab' parameter when redirecting to the comment (via _find())
*/
public static $tabParameter = array( 'activeTab' => 'comments' );
/**
* Can promote this comment/item?
*
* @param \IPS\Member|NULL $member The member to check for (NULL for currently logged in member)
* @return boolean
*/
public function canPromoteToSocialMedia( $member=NULL )
{
return FALSE;
}
public static ?array $tabParameter = array( 'activeTab' => 'comments' );
}