Version 3.1.4

This commit is contained in:
Neo committed 2025-12-19 00:32:22 -08:00
1 parent 1d4720f3e2
commit ae5c01cc78
2563 files changed
+283048 -240689

No files matched your search

@@ -1,18 +1,20 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.0.5
* IP.Board v3.1.4
* Public session handler
* Last Updated: $Date: 2009-10-14 07:03:55 -0400 (Wed, 14 Oct 2009) $
* Last Updated: $Date: 2010-10-06 06:09:32 -0400 (Wed, 06 Oct 2010) $
* </pre>
*
* @author $Author: matt $
* @author $Author: mmecham $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @link http://www.iinvisionpower.com
* @license http://www.invisionpower.com/community/board/license.html
* @package IP.Board
* @link http://www.invisionpower.com
* @since 26th January 2004
* @version $Revision: 5229 $
* @version $Revision: 6946 $
*
*/
@@ -551,7 +553,14 @@ class publicSessions extends ips_MemberRegistry
}
else
{
@header('HTTP/1.1 403 Forbidden');
if ( isset( $_SERVER['SERVER_PROTOCOL'] ) AND strstr( $_SERVER['SERVER_PROTOCOL'], '/1.0' ) )
{
@header('HTTP/1.0 403 Forbidden');
}
else
{
@header('HTTP/1.1 403 Forbidden');
}
}
@header("Cache-Control: no-cache, must-revalidate, max-age=0");
@@ -567,7 +576,7 @@ class publicSessions extends ips_MemberRegistry
// Still no member id and not a bot?
//-----------------------------------------
if ( ! self::$data_store['member_id'] AND ! $this->_member->is_not_human )
if ( empty( self::$data_store['member_id'] ) AND ! $this->_member->is_not_human )
{
self::setMember(0);
@@ -579,8 +588,8 @@ class publicSessions extends ips_MemberRegistry
// Set a session ID cookie
//-----------------------------------------
$this->_member->session_type = $this->session_type;
$this->_member->session_id = $this->session_id;
$this->_member->session_type = $this->session_type;
$this->_member->session_id = $this->session_id;
IPSCookie::set("session_id", $this->session_id, -1);
}
@@ -596,7 +605,7 @@ class publicSessions extends ips_MemberRegistry
*/
public function addQueryKey( $key, $value, $sessionID='' )
{
$sessionID = ( $sessionID ) ? IPSText::md5Clean( $sessionID ) : $this->session_id;
$sessionID = ( $sessionID ) ? substr( IPSText::alphanumericalClean( $sessionID, '_=' ), 0, 32 ) : $this->session_id;
if ( $key )
{
@@ -672,7 +681,6 @@ class publicSessions extends ips_MemberRegistry
'member_group' => self::$data_store['member_group_id'],
'login_type' => intval(substr(self::$data_store['login_anonymous'],0, 1)),
'running_time' => IPS_UNIX_TIME_NOW,
'location' => isset( $vars['location'] ) ? $vars['location'] : '',
'in_error' => 0,
'current_appcomponent' => $this->current_appcomponent,
'current_module' => $this->current_module,
@@ -697,7 +705,7 @@ class publicSessions extends ips_MemberRegistry
/* Reset some data */
$this->session_type = 'cookie';
$this->session_id = "";
//$this->session_id = "";
}
/* Set type */
@@ -777,7 +785,6 @@ class publicSessions extends ips_MemberRegistry
'member_group' => $memberGroup,
'login_type' => $loginType,
'running_time' => IPS_UNIX_TIME_NOW,
'location' => $vars['location'],
'in_error' => 0,
'current_appcomponent' => $this->current_appcomponent,
'current_module' => $this->current_module,
@@ -802,7 +809,7 @@ class publicSessions extends ips_MemberRegistry
/* Reset some data */
$this->session_type = 'cookie';
$this->session_id = "";
//$this->session_id = "";
}
/* Set type */
@@ -868,7 +875,6 @@ class publicSessions extends ips_MemberRegistry
'running_time' => IPS_UNIX_TIME_NOW,
'ip_address' => $this->_member->ip_address,
'browser' => $this->_userAgent,
'location' => isset( $vars['location'] ) ? $vars['location'] : '',
'in_error' => 0,
'current_appcomponent' => $this->current_appcomponent,
'current_module' => $this->current_module,
@@ -943,7 +949,7 @@ class publicSessions extends ips_MemberRegistry
/* Reset some data */
$this->session_type = 'cookie';
$this->session_id = "";
//$this->session_id = "";
}
/* Set type */
@@ -1044,7 +1050,6 @@ class publicSessions extends ips_MemberRegistry
'running_time' => IPS_UNIX_TIME_NOW,
'ip_address' => $this->_member->ip_address,
'browser' => substr( $this->_member->user_agent, 0, 200 ),
'location' => $vars['location'],
'in_error' => 0,
'current_appcomponent' => $this->current_appcomponent,
'current_module' => $this->current_module,
@@ -1083,7 +1088,7 @@ class publicSessions extends ips_MemberRegistry
/* Reset some data */
$this->session_type = 'cookie';
$this->session_id = "";
//$this->session_id = "";
}
/* Set type */
@@ -1097,20 +1102,24 @@ class publicSessions extends ips_MemberRegistry
*
* @access public
* @param array Array of incoming data (member_id, member_name, member_group, login_type)
* @param array Optional array of member data (prevents having to reload it)
* @return string Current session ID
*/
public function convertGuestToMember( $data )
public function convertGuestToMember( $data, $member=array() )
{
/* Delete old sessions */
$this->_destroySessions( "ip_address='" . $this->_member->ip_address . "' AND id != '{$this->session_id}'" );
/* Fetch member */
$member = IPSMember::load( $data['member_id'], 'core' );
if( !$member['member_id'] )
{
$member = IPSMember::load( $data['member_id'], 'core' );
}
/* Update this session directly */
$this->DB->update( 'sessions', array(
'member_name' => $data['member_name'],
'seo_name' => IPSText::makeSeoTitle( $data['member_name'] ),
'seo_name' => $member['members_seo_name'],
'member_id' => $data['member_id'],
'running_time' => time(),
'member_group' => $data['member_group'],
@@ -1126,10 +1135,6 @@ class publicSessions extends ips_MemberRegistry
{
$update['last_visit'] = $member['last_activity'];
}
else
{
$update['last_visit'] = time();
}
/* Make sure last activity and last visit are up to date */
IPSMember::save( $data['member_id'], array( 'core' => $update ) );
@@ -1157,12 +1162,13 @@ class publicSessions extends ips_MemberRegistry
$this->_destroySessions( "ip_address='" . $this->_member->ip_address . "' AND id != '{$this->session_id}'" );
/* Update this session directly */
$this->DB->update( 'sessions', array(
'member_name' => '',
'seo_name' => '',
'member_id' => 0,
'running_time' => time(),
'member_group' => $this->settings['guest_group'] ) , "id='" . $this->session_id . "'", TRUE );
$data = array( 'member_name' => '',
'seo_name' => '',
'member_id' => 0,
'running_time' => time(),
'member_group' => $this->settings['guest_group'] );
$this->DB->update( 'sessions', $data, "id='" . $this->session_id . "'", TRUE );
/* Remove from update and delete array */
unset( $this->_sessionsToSave[ $this->session_id ] );
@@ -1233,7 +1239,7 @@ class publicSessions extends ips_MemberRegistry
//-----------------------------------------
$result = array();
$session_id = IPSText::md5Clean( $session_id );
$session_id = substr( IPSText::alphanumericalClean( $session_id, '_=' ), 0, 32 );
if ( $session_id )
{
@@ -1321,7 +1327,6 @@ class publicSessions extends ips_MemberRegistry
$this->session_id = $this->session_data['id'];
$this->session_user_id = $this->session_data['member_id'];
$this->last_click = $this->session_data['running_time'];
$this->location = $this->session_data['location'];
IPSDebug::addLogMessage( "Authorization attempt successful: Session ID={$session_id}, member ID={$this->session_data['member_id']} ", 'sessions-' . $this->session_data['member_id'] );
@@ -1466,7 +1471,7 @@ class publicSessions extends ips_MemberRegistry
//-----------------------------------------
$memberID = intval( $memberID );
$sessionID = IPSText::md5Clean( $sessionID );
$sessionID = substr( IPSText::alphanumericalClean( $sessionID, '_=' ), 0, 32 );
$_data = array();
$_ignore = array( 'id',
'member_id',