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

+15 -67
View File
@@ -11,7 +11,7 @@
namespace IPS\Member;
/* 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;
@@ -75,7 +75,7 @@ class _GroupPromotion extends \IPS\Node\Model
/**
* Form
*
* @param \IPS\Helpers\Form The form
* @param \IPS\Helpers\Form $form The form
* @return void
*/
public function form( &$form )
@@ -197,7 +197,7 @@ class _GroupPromotion extends \IPS\Node\Model
/* Now we have to remove any fields that aren't valid... */
foreach( $values as $k => $v )
{
if( !in_array( $k, array( 'promote_enabled', 'promote_filters', 'promote_actions', 'promote_position' ) ) )
if( !\in_array( $k, array( 'promote_enabled', 'promote_filters', 'promote_actions', 'promote_position' ) ) )
{
unset( $values[ $k ] );
}
@@ -232,11 +232,12 @@ class _GroupPromotion extends \IPS\Node\Model
* @param string|NULL $permissionCheck The permission key to check for or NULl to not check permissions
* @param \IPS\Member|NULL $member The member to check permissions for or NULL for the currently logged in member
* @param mixed $where Additional WHERE clause
* @param array|NULL $limit Limit/offset to use, or NULL for no limit (default)
* @return array
*/
public static function roots( $permissionCheck='view', $member=NULL, $where=array() )
public static function roots( $permissionCheck='view', $member=NULL, $where=array(), $limit=NULL )
{
if ( !count( $where ) )
if ( !\count( $where ) )
{
$return = array();
foreach( static::getStore() AS $node )
@@ -248,22 +249,10 @@ class _GroupPromotion extends \IPS\Node\Model
}
else
{
return parent::roots( $permissionCheck, $member, $where );
return parent::roots( $permissionCheck, $member, $where, $limit );
}
}
/**
* Set Enabled
*
* @return void
*/
public function set__enabled( $enabled )
{
parent::set__enabled( $enabled );
unset( \IPS\Data\Store::i()->group_promotions );
}
/**
* Get data store
*
@@ -281,57 +270,16 @@ class _GroupPromotion extends \IPS\Node\Model
}
/**
* Load Record
*
* @see \IPS\Db::build
* @param int|string $id ID
* @param string $idField The database column that the $id parameter pertains to (NULL will use static::$databaseColumnId)
* @param mixed $extraWhereClause Additional where clause(s) (see \IPS\Db::build for details)
* @return static
* @throws \InvalidArgumentException
* @throws \OutOfRangeException
* @brief [ActiveRecord] Caches
* @note Defined cache keys will be cleared automatically as needed
*/
public static function load( $id, $idField=NULL, $extraWhereClause=NULL )
{
if ( ( $idField === NULL or $idField === 'promote_id' ) and $extraWhereClause === NULL )
{
$promotions = static::getStore();
if ( isset( $promotions[ $id ] ) )
{
return static::constructFromData( $promotions[ $id ] );
}
else
{
throw new \OutOfRangeException;
}
}
return parent::load( $id, $idField, $extraWhereClause );
}
protected $caches = array( 'group_promotions' );
/**
* [ActiveRecord] Delete
*
* @return void
* @brief [ActiveRecord] Attempt to load from cache
* @note If this is set to TRUE you MUST define a getStore() method to return the objects from cache
*/
public function delete()
{
parent::delete();
unset( \IPS\Data\Store::i()->group_promotions );
}
/**
* [ActiveRecord] Save Changed Columns
*
* @return void
*/
public function save()
{
parent::save();
unset( \IPS\Data\Store::i()->group_promotions );
}
protected static $loadFromCache = TRUE;
/**
* @brief Cache extensions so we only need to load them once
@@ -394,7 +342,7 @@ class _GroupPromotion extends \IPS\Node\Model
$showWarning = TRUE;
}
}
if ( count( $action['secondary_group'] ) )
if ( \count( $action['secondary_group'] ) )
{
foreach ( $action['secondary_group'] as $key => $group )
{