Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -65,7 +65,8 @@ class _groups extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
if ( $row['g_id'] == \IPS\Settings::i()->guest_group )
|
||||
{
|
||||
$onlineGuests = \IPS\Db::i()->select( 'COUNT(*)', 'core_sessions', array( 'login_type=? AND running_time>?', \IPS\Session\Front::LOGIN_TYPE_GUEST, \IPS\DateTime::create()->sub( new \DateInterval( 'PT30M' ) )->getTimeStamp() ) )->first();
|
||||
$onlineGuests = \IPS\Session\Store::i()->getOnlineUsers( \IPS\Session\Store::ONLINE_GUESTS | \IPS\Session\Store::ONLINE_COUNT_ONLY );
|
||||
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'online_guests', FALSE, array( 'pluralize' => array( $onlineGuests ) ) );
|
||||
}
|
||||
|
||||
@@ -88,8 +89,20 @@ class _groups extends \IPS\Dispatcher\Controller
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=members&controller=groups&do=form' ),
|
||||
);
|
||||
}
|
||||
|
||||
/* Show an extra warning if we are going to delete a group that Commerce intends to move subscribers back to */
|
||||
if( \IPS\Db::i()->checkForColumn( 'core_members', 'cm_return_group' ) )
|
||||
{
|
||||
$warnGroups = array();
|
||||
|
||||
try
|
||||
{
|
||||
$warnGroups = iterator_to_array( \IPS\Db::i()->select( 'DISTINCT(cm_return_group)', 'core_members' ) );
|
||||
}
|
||||
catch( \Exception $e ){}
|
||||
}
|
||||
|
||||
$table->rowButtons = function( $row )
|
||||
$table->rowButtons = function( $row ) use ( $warnGroups )
|
||||
{
|
||||
$return = array();
|
||||
|
||||
@@ -137,7 +150,9 @@ class _groups extends \IPS\Dispatcher\Controller
|
||||
'icon' => 'times-circle',
|
||||
'title' => 'delete',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=members&controller=groups&do=delete&id=' ) . $row['g_id'],
|
||||
'data' => \IPS\Db::i()->select( 'COUNT(*)', 'core_members', array( 'member_group_id=?', $row['g_id'] ) )->first() ? array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack( "core_group_{$row['g_id']}" ) ) : array( 'delete' => '' ),
|
||||
'data' => \IPS\Db::i()->select( 'COUNT(*)', 'core_members', array( 'member_group_id=?', $row['g_id'] ) )->first() ?
|
||||
array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack( "core_group_{$row['g_id']}" ) ) :
|
||||
array( 'delete' => '', 'delete-warning' => ( in_array( $row['g_id'], $warnGroups ) ) ? \IPS\Member::loggedIn()->language()->addToStack( "nexus_dont_delete_group", FALSE, array( 'sprintf' => array( \IPS\Member\Group::load( \IPS\Settings::i()->member_group )->name ) ) ) : '' ),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -300,7 +315,19 @@ class _groups extends \IPS\Dispatcher\Controller
|
||||
|
||||
if ( isset( $current[ $class::$permApp ][ $class::$permType ] ) )
|
||||
{
|
||||
$matrix->rows = call_user_func( $callback, $current[ $class::$permApp ][ $class::$permType ], $group );
|
||||
try
|
||||
{
|
||||
$matrix->rows = call_user_func( $callback, $current[ $class::$permApp ][ $class::$permType ], $group );
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
if( $e->getCode() != 199 )
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
|
||||
\IPS\Output::i()->error( 'generic_error', '4T382/1', 500, $e->getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
/* Add the matrix */
|
||||
@@ -358,7 +385,7 @@ class _groups extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Copy */
|
||||
$newGroup = clone $group;
|
||||
\IPS\Session::i()->log( 'acplog__groups_copied', array( $newGroup->name => FALSE ) );
|
||||
\IPS\Session::i()->log( 'acplog__groups_copied', array( "core_group_". $newGroup->g_id => TRUE ) );
|
||||
|
||||
/* And redirect */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=members&controller=groups&do=form&id={$newGroup->g_id}" ) );
|
||||
@@ -372,17 +399,15 @@ class _groups extends \IPS\Dispatcher\Controller
|
||||
public function delete()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'groups_delete' );
|
||||
|
||||
/* Make sure the user confirmed the deletion */
|
||||
\IPS\Request::i()->confirmedDelete();
|
||||
|
||||
/* Load group */
|
||||
try
|
||||
{
|
||||
$group = \IPS\Member\Group::load( \IPS\Request::i()->id );
|
||||
$count = \IPS\Db::i()->select( 'COUNT(*)', 'core_members', array( 'member_group_id=?', $group->g_id ) )->first();
|
||||
|
||||
/* Any members in it? */
|
||||
if ( \IPS\Db::i()->select( 'COUNT(*)', 'core_members', array( 'member_group_id=?', $group->g_id ) )->first() )
|
||||
if ( $count )
|
||||
{
|
||||
/* Create the options, but don't let the admin move members in the group back into this same group */
|
||||
$groupOptions = \IPS\Member\Group::groups( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'members', 'member_move_admin2' ), FALSE );
|
||||
@@ -402,6 +427,11 @@ class _groups extends \IPS\Dispatcher\Controller
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make sure the user confirmed the deletion */
|
||||
\IPS\Request::i()->confirmedDelete();
|
||||
}
|
||||
|
||||
/* remove this from members secondary groups column */
|
||||
foreach ( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_members', \IPS\Db::i()->findInSet( 'mgroup_others', array( $group->g_id ) ) ), 'IPS\Member') AS $member )
|
||||
@@ -416,11 +446,13 @@ class _groups extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
$member->mgroup_others = implode( ',', array_filter( $secondaryGroups ) );
|
||||
$member->save();
|
||||
\IPS\Db::i()->update( 'core_members', array( 'mgroup_others' => implode( ',', array_filter( $secondaryGroups ) ) ), array( 'member_id=?', $member->member_id ) );
|
||||
}
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__groups_deleted', array( $group->name => FALSE ) );
|
||||
$name = $group->name;
|
||||
\IPS\Member::loggedIn()->language()->parseOutputForDisplay( $name );
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__groups_deleted', array( $name => FALSE ) );
|
||||
$group->delete();
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
|
||||
Reference in new issue
Block a user