Version 4.3.6

This commit is contained in:
Neo committed 2025-12-19 05:49:12 -08:00
1 parent fe1acf984a
commit 1a0c7fd3c2
609 files changed
+14707 -5726

No files matched your search

+5 -45
View File
@@ -74,7 +74,7 @@ class _Database extends \IPS\Session\Store
*/
public function updateSession( $data )
{
\IPS\Db::i()->replace( 'core_sessions', $data, TRUE );
\IPS\Db::i()->insert( 'core_sessions', $data, TRUE );
}
/**
@@ -155,15 +155,14 @@ class _Database extends \IPS\Session\Store
/**
* Fetch all online users (but not spiders)
*
* @param int $flags Bitwise flags
* @param array $skipGroups Ignore members in these groups
* @param int $flags Bitwise flags
* @param string $sort Sort direction
* @param array|NULL $limit Limit [ offset, limit ]
* @param int $memberGroup Limit by a specific member group ID
* @param boolean $showAnonymous Show anonymously logged in peoples?
* @param boolean $includeAllGroups Include all groups? Used for statistics primarily.
* @return array
*/
public function getOnlineUsers( $flags=0, $sort='desc', $limit=NULL, $memberGroup=NULL, $showAnonymous=FALSE, $includeAllGroups=FALSE )
public function getOnlineUsers( $flags=0, $sort='desc', $limit=NULL, $memberGroup=NULL, $showAnonymous=FALSE )
{
/* Query */
$where = array(
@@ -175,23 +174,6 @@ class _Database extends \IPS\Session\Store
{
$where[] = array( "s.login_type!=?", \IPS\Session\Front::LOGIN_TYPE_ANONYMOUS );
}
if( ! $includeAllGroups )
{
$notInMyName = array();
foreach( \IPS\Member\Group::groups() as $group )
{
if ( $group->g_hide_online_list )
{
$notInMyName[] = $group->g_id;
}
}
if ( count( $notInMyName ) )
{
$where[] = array( \IPS\Db::i()->in( 's.member_group', $notInMyName, TRUE ) );
}
}
if ( ! $flags and ! $limit )
{
@@ -205,14 +187,6 @@ class _Database extends \IPS\Session\Store
/* 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( ! $includeAllGroups )
{
if ( count( $notInMyName ) )
{
$where[] = array( \IPS\Db::i()->in( 'core_sessions.member_group', $notInMyName, TRUE ) );
}
}
/* Limiting to a user group? */
if ( $memberGroup )
@@ -269,21 +243,7 @@ class _Database extends \IPS\Session\Store
{
$where[] = array( 'core_sessions.current_id = ?', \IPS\Request::i()->id );
}
$notInMyName = array();
foreach( \IPS\Member\Group::groups() as $group )
{
if ( $group->g_hide_online_list )
{
$notInMyName[] = $group->g_id;
}
}
if ( count( $notInMyName ) )
{
$where[] = array( \IPS\Db::i()->in( 'core_sessions.member_group', $notInMyName, TRUE ) );
}
foreach( \IPS\Db::i()->select( 'core_sessions.member_id,core_sessions.member_name,core_sessions.seo_name,core_sessions.member_group,core_sessions.login_type,core_sessions.in_editor', 'core_sessions', $where, 'core_sessions.running_time DESC' ) as $row )
{
if( $row['login_type'] == \IPS\Session\Front::LOGIN_TYPE_MEMBER and $row['member_name'] )
+13 -11
View File
@@ -67,10 +67,7 @@ class _Redis extends \IPS\Session\Store
), static::$ttl );
/* Update the list of sessions for the online list [ microtime => sessionID ] */
if ( ! $group->g_hide_online_list )
{
\IPS\Redis::i()->zAdd( $this->_key( 'session_map' ), time(), 'session_id_' . md5( $data['id'] . \IPS\Settings::i()->sql_pass ), static::$ttl );
}
\IPS\Redis::i()->zAdd( $this->_key( 'session_map' ), time(), 'session_id_' . md5( $data['id'] . \IPS\Settings::i()->sql_pass ), static::$ttl );
/* Update users list */
if ( $data['uagent_type'] == 'search' )
@@ -78,7 +75,7 @@ class _Redis extends \IPS\Session\Store
/* Make a unique row based on IP and user-agent to prevent multiple rows for each spider */
\IPS\Redis::i()->zAdd( $this->_key( 'session_online_spiders' ), time(), md5( $data['ip_address'] . $data['browser'] ), static::$ttl );
}
else if ( $data['member_id'] and ! $group->g_hide_online_list )
else if ( $data['member_id'] )
{
\IPS\Redis::i()->zAdd( $this->_key( 'session_online_users' ), time(), $data['member_id'] . '__' . 'session_id_' . md5( $data['id'] . \IPS\Settings::i()->sql_pass ), static::$ttl );
}
@@ -237,15 +234,14 @@ class _Redis extends \IPS\Session\Store
/**
* Fetch all online users (but not spiders)
*
* @param int $flags Bitwise flags
* @param array $skipGroups Ignore members in these groups
* @param int $flags Bitwise flags
* @param string $sort Sort direction
* @param array|NULL $limit Limit [ offset, limit ]
* @param int $memberGroup Limit by a specific member group ID
* @param boolean $showAnonymous Show anonymously logged in peoples?
* @param boolean $includeAllGroups Include all groups? Used for statistics primarily.
* @return array
*/
public function getOnlineUsers( $flags=0, $sort='desc', $limit=NULL, $memberGroup=NULL, $showAnonymous=FALSE, $includeAllGroups=FALSE )
public function getOnlineUsers( $flags=0, $sort='desc', $limit=NULL, $memberGroup=NULL, $showAnonymous=FALSE )
{
$results = \IPS\Redis::i()->lRange('session_onlinelist', 0, -1 );
@@ -256,7 +252,7 @@ class _Redis extends \IPS\Session\Store
'store' => \IPS\Redis::i()->prefix . 'session_onlinelist',
'alpha' => true,
'by' => 'nosort ' . $sort === 'asc' ? 'asc' : 'desc',
'ttl' => 60,
'ttl' => 30, /* This ensures the stored file session_online only lasts for 30 seconds */
'get' => array(
$this->_key( \IPS\Redis::i()->prefix ) . '*->member_id',
$this->_key( \IPS\Redis::i()->prefix ) . '*->member_name',
@@ -300,6 +296,12 @@ class _Redis extends \IPS\Session\Store
continue;
}
/* Cut off is 30 mins */
if ( $data['running_time'] < ( time() - ( 30 * 60 ) ) )
{
continue;
}
$return[ $fields['member_id'] ? $fields['member_id'] : $data['ip_address'] ] = array_merge( $data, $fields );
}
}
@@ -372,7 +374,7 @@ class _Redis extends \IPS\Session\Store
foreach( $this->getOnlineUsers( 0, 'desc' ) as $member )
{
if ( ! \IPS\Member\Group::load( $member['member_group'] )->g_hide_online_list and $member['current_appcomponent'] == $app and $member['current_module'] == $module and $member['current_controller'] = $controller and $member['current_id'] = $id )
if ( $member['current_appcomponent'] == $app and $member['current_module'] == $module and $member['current_controller'] = $controller and $member['current_id'] = $id )
{
if ( $url and mb_stristr( $member['location_url'], $url ) )
{