Version 4.1.2

This commit is contained in:
Neo committed 2025-12-19 05:32:19 -08:00
1 parent 3ba79295ee
commit 28bd025b35
1131 files changed
+63658 -20579

No files matched your search

+3 -1
View File
@@ -97,7 +97,7 @@ class _Admin extends \IPS\Session
*
* @param string $sessionId Session ID
* @param string $data Session Data
* @return void
* @return bool
*/
public function write( $sessionId, $data )
{
@@ -113,6 +113,8 @@ class _Admin extends \IPS\Session
'session_url' => \IPS\Request::i()->url(),
'session_app_data' => $data
) );
return TRUE;
}
/**
+36 -14
View File
@@ -127,7 +127,7 @@ class _Front extends \IPS\Session
/* Store this so plugins can access */
$this->sessionData = $session;
/* Got one? */
if ( $session )
{
@@ -200,7 +200,7 @@ class _Front extends \IPS\Session
{
$type = $this->userAgent->spider ? static::LOGIN_TYPE_SPIDER : static::LOGIN_TYPE_GUEST;
}
/* Set data */
$this->data = array(
'id' => $sessionId,
@@ -211,10 +211,10 @@ class _Front extends \IPS\Session
'browser' => isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '',
'running_time' => time(),
'login_type' => $type,
'member_group' => ($this->member->member_id) ? $this->member->member_group_id : \IPS\Settings::i()->guest_group,
'current_appcomponent' => '',
'current_module' => '',
'current_controller' => NULL,
'member_group' => ( $this->member->member_id ) ? $this->member->member_group_id : \IPS\Settings::i()->guest_group,
'current_appcomponent' => ( \IPS\Request::i()->isAjax() ) ? ( $session ? $session['current_appcomponent'] : '' ) : '',
'current_module' => ( \IPS\Request::i()->isAjax() ) ? ( $session ? $session['current_module'] : '' ) : '',
'current_controller' => ( \IPS\Request::i()->isAjax() ) ? ( $session ? $session['current_controller'] : NULL ) : NULL,
'current_id' => intval( \IPS\Request::i()->id ),
'uagent_key' => $this->userAgent->useragentKey,
'uagent_version' => $this->userAgent->useragentVersion ?: '',
@@ -261,11 +261,10 @@ class _Front extends \IPS\Session
/* Make sure login key has been set */
$member->checkLoginKey();
/* Set the cookies */
/* Set the cookie */
$expire = new \IPS\DateTime;
$expire->add( new \DateInterval( 'P7D' ) );
\IPS\Request::i()->setCookie( 'member_id', $member->member_id, $expire );
\IPS\Request::i()->setCookie( 'pass_hash', $member->member_login_key, $expire );
/* Make sure session handler saves during write() */
$this->save = TRUE;
@@ -276,7 +275,7 @@ class _Front extends \IPS\Session
*
* @param string $sessionId Session ID
* @param string $data Session Data
* @return void
* @return bool
*/
public function write( $sessionId, $data )
{
@@ -297,6 +296,8 @@ class _Front extends \IPS\Session
{
\IPS\Db::i()->replace( 'core_sessions', $this->data, TRUE );
}
return TRUE;
}
/**
@@ -397,7 +398,13 @@ class _Front extends \IPS\Session
{
$this->setLocationData();
}
/* Some places use 0 to mean no permission at all but this is lost in the code below */
if ( $groupIds === 0 )
{
$groupIds = (string) $groupIds;
}
$groupIds = is_string( $groupIds ) ? explode( ',', $groupIds ) : ( $groupIds ?: NULL );
$app = \IPS\Application::load( $this->data['current_appcomponent'] );
@@ -511,13 +518,28 @@ class _Front extends \IPS\Session
*/
public function gc( $lifetime )
{
foreach ( \IPS\Db::i()->select( '*', 'core_sessions', array( 'running_time<?', ( time() - $lifetime ) ) ) as $row )
static::clearSessions( $lifetime );
return TRUE;
}
/**
* Clear sessions - abstracted so it can be called externally without initiating a session
*
* @param int $lifetime Unix timestamp of the oldest session to keep
* @return void
*/
public static function clearSessions( $lifetime )
{
/* Only bother looping on sessions if we have a cache method set */
if( \IPS\CACHE_METHOD !== 'None' )
{
$key = "session_{$row['id']}";
unset( \IPS\Data\Cache::i()->$key );
foreach ( \IPS\Db::i()->select( '*', 'core_sessions', array( 'running_time<?', ( time() - $lifetime ) ) ) as $row )
{
$key = "session_{$row['id']}";
unset( \IPS\Data\Cache::i()->$key );
}
}
\IPS\Db::i()->delete( 'core_sessions', array( 'running_time<?', ( time() - $lifetime ) ) );
return TRUE;
}
}