Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

@@ -2,9 +2,9 @@
/**
* @brief Online Users
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 21 Aug 2013
* @version SVN_VERSION_NUMBER
*/
@@ -37,18 +37,38 @@ class _online extends \IPS\Dispatcher\Controller
\IPS\Session\Front::i()->setTheme( \IPS\Member::loggedIn()->skin ?: 0 );
session_write_close();
$notInMyName = array();
foreach( \IPS\Member\Group::groups() as $group )
{
if ( $group->g_hide_online_list )
{
$notInMyName[] = $group->g_id;
}
}
/* Initial filters */
$where = array(
array( "core_sessions.running_time>?", \IPS\DateTime::create()->sub( new \DateInterval( 'PT30M' ) )->getTimeStamp() ),
array( "core_sessions.login_type!=?", \IPS\Session\Front::LOGIN_TYPE_SPIDER )
$subWhere = array(
array( "s.running_time>?", \IPS\DateTime::create()->sub( new \DateInterval( 'PT30M' ) )->getTimeStamp() ),
array( "s.login_type!=?", \IPS\Session\Front::LOGIN_TYPE_SPIDER )
);
if ( !\IPS\Member::loggedIn()->isAdmin() )
{
$where[] = array( "core_sessions.login_type!=?", \IPS\Session\Front::LOGIN_TYPE_ANONYMOUS );
$subWhere[] = array( "s.login_type!=?", \IPS\Session\Front::LOGIN_TYPE_ANONYMOUS );
}
$where[] = "core_groups.g_hide_online_list=0";
if ( count( $notInMyName ) )
{
$subWhere[] = array( \IPS\Db::i()->in( 's.member_group', $notInMyName, TRUE ) );
}
/* Ok, this looks odd, but the ONLY_FULL_GROUP_BY bites us here, so selecting max(id) allows us to return a session ID even though we're grouping on member_id */
$where = array( array( "( core_sessions.id IN(?) OR ( core_sessions.member_id IS NULL AND core_sessions.login_type != ? AND core_sessions.running_time > ?) )", \IPS\Db::i()->select( 'MAX(id)', array( 'core_sessions', 's' ), $subWhere, NULL, NULL, 'member_id' ), \IPS\Session\Front::LOGIN_TYPE_SPIDER, \IPS\DateTime::create()->sub( new \DateInterval( 'PT30M' ) )->getTimeStamp() ) );
if ( count( $notInMyName ) )
{
$where[] = array( \IPS\Db::i()->in( 'core_sessions.member_group', $notInMyName, TRUE ) );
}
/* Create the table */
$table = new \IPS\Helpers\Table\Db( 'core_sessions', \IPS\Http\Url::internal( 'app=core&module=online&controller=online', 'front', 'online' ), $where );
$table->tableTemplate = array( \IPS\Theme::i()->getTemplate( 'online', 'core', 'front' ), 'onlineUsersTable' );
@@ -57,20 +77,7 @@ class _online extends \IPS\Dispatcher\Controller
$table->include = array( 'photo', 'member_name', 'location_lang', 'running_time', 'ip_address', 'login_type' );
$table->limit = 30;
$table->noSort = array( 'photo', 'location_lang' );
/* Joins */
$table->joins = array(
array(
'select' => 'm.member_id',
'from' => array( 'core_members', 'm' ),
'where' => 'm.member_id=core_sessions.member_id'
),
array(
'from' => 'core_groups',
'where' => 'core_sessions.member_group=core_groups.g_id'
),
);
/* Custom parsers */
$table->parsers = array(
'location_lang' => function( $val, $row )
@@ -99,10 +106,10 @@ class _online extends \IPS\Dispatcher\Controller
);
$table->filters = array(
'filter_loggedin' => 'm.member_id <> 0',
'filter_loggedin' => 'core_sessions.member_id <> 0',
);
foreach ( \IPS\Member\Group::groups() as $group )
foreach ( \IPS\Member\Group::groups( TRUE, TRUE, TRUE ) as $group )
{
/* Hiding from online list? */
if( $group->g_hide_online_list )
@@ -117,11 +124,11 @@ class _online extends \IPS\Dispatcher\Controller
if( $group->g_id == \IPS\Settings::i()->guest_group )
{
$table->filters[ 'group_' . $group->g_id ] = 'm.member_id IS NULL';
$table->filters[ 'group_' . $group->g_id ] = 'core_sessions.member_id IS NULL';
}
else
{
$table->filters[ 'group_' . $group->g_id ] = 'm.member_group_id=' . $group->g_id;
$table->filters[ 'group_' . $group->g_id ] = 'core_sessions.member_group=' . $group->g_id;
}
}