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

+63 -5
View File
@@ -98,11 +98,12 @@ trait ClubContainer
{
$nodeClass = get_called_class();
$itemClass = $nodeClass::$contentItemClass;
$haveId = (bool) $this->_id;
$this->_saveClubForm( $club, $values );
$needToUpdatePermissions = FALSE;
if ( !$this->_id )
if ( !$haveId )
{
$clubIdColumn = $this->clubIdColumn();
$this->$clubIdColumn = $club->id;
@@ -129,6 +130,12 @@ trait ClubContainer
{
$this->setPermissionsToClub( $club );
}
$followApp = $itemClass::$application;
$followArea = mb_strtolower( mb_substr( $nodeClass, mb_strrpos( $nodeClass, '\\' ) + 1 ) );
$time = time();
\IPS\Db::i()->insert( 'core_follow', \IPS\Db::i()->select( "MD5( CONCAT( '{$followApp};{$followArea};{$this->_id};', follow_member_id ) ) AS follow_id, '{$followApp}' AS follow_app, '{$followArea}' AS follow_area, '{$this->_id}' AS follow_rel_id, follow_member_id, follow_is_anon, '{$time}' AS follow_added, follow_notify_do, follow_notify_meta, follow_notify_freq, 0 AS follow_notify_sent, follow_visible", 'core_follow', array(
'follow_app=? AND follow_area=? AND follow_rel_id=?', 'core', 'club', $club->id ) ) );
}
/**
@@ -164,6 +171,7 @@ trait ClubContainer
{
case $club::TYPE_PUBLIC:
case $club::TYPE_OPEN:
case $club::TYPE_READONLY:
$insert[ 'perm_' . $v ] = '*';
break;
@@ -173,11 +181,28 @@ trait ClubContainer
break;
}
}
elseif ( in_array( $k, array( 'add', 'edit', 'reply', 'review' ) ) )
{
switch ( $club->type )
{
case $club::TYPE_PUBLIC:
$insert[ 'perm_' . $v ] = 'ca';
break;
case $club::TYPE_OPEN:
case $club::TYPE_CLOSED:
case $club::TYPE_PRIVATE:
case $club::TYPE_READONLY:
$insert[ 'perm_' . $v ] = "cm,c{$club->id}";
break;
}
}
else
{
switch ( $club->type )
{
case $club::TYPE_PUBLIC:
case $club::TYPE_READONLY:
$insert[ 'perm_' . $v ] = 'ca';
break;
@@ -226,8 +251,40 @@ trait ClubContainer
{
$where[] = array( static::$databasePrefix . static::$databaseColumnParent . '=?', static::$databaseColumnParentRootValue );
}
$order = static::$databasePrefix . static::clubIdColumn();
return static::nodesWithPermission( $permissionCheck, $member, $where );
if( static::$databaseColumnOrder !== NULL )
{
$order .= ', ' . static::$databasePrefix . static::$databaseColumnOrder;
}
return static::nodesWithPermission( $permissionCheck, $member, $where, $order );
}
/**
* @brief Cached club nodes
*/
protected static $cachedClubNodes = NULL;
/**
* Fetch All Nodes in Clubs
*
* @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
* @return array
*/
public static function clubNodes( $permissionCheck='view', $member=NULL, $where=array() )
{
if( static::$cachedClubNodes === NULL )
{
$where[] = array( static::$databasePrefix . static::clubIdColumn() . ' IS NOT NULL' );
static::$cachedClubNodes = static::nodesWithPermission( $permissionCheck, $member, $where );
}
return static::$cachedClubNodes;
}
/**
@@ -235,9 +292,10 @@ trait ClubContainer
*
* @param string $type 'edit', 'hide', 'unhide', 'delete', etc.
* @param \IPS\Member|NULL $member The member to check for or NULL for the currently logged in member
* @param string|NULL $itemClass The item class to check against, or NULL to check against static::$contentItemClass
* @return bool
*/
public function modPermission( $type, \IPS\Member $member )
public function modPermission( $type, \IPS\Member $member, $itemClass=NULL )
{
if ( \IPS\Settings::i()->clubs )
{
@@ -253,8 +311,8 @@ trait ClubContainer
}
}
}
return parent::modPermission( $type, $member );
return parent::modPermission( $type, $member, $itemClass );
}
/**