Vergleich inc/class_session.php - 1.8.4 - 1.8.22

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 10Zeile 10

class session
{


class session
{

 
	/**
* @var int
*/

	public $sid = 0;

	public $sid = 0;

 
	/**
* @var int
*/

	public $uid = 0;

	public $uid = 0;

 
	/**
* @var string
*/

	public $ipaddress = '';

	public $ipaddress = '';

 
	/**
* @var string
*/

	public $packedip = '';

	public $packedip = '';

 
	/**
* @var string
*/

	public $useragent = '';

	public $useragent = '';

 
	/**
* @var bool
*/

	public $is_spider = false;

/**

	public $is_spider = false;

/**

Zeile 87Zeile 105
	/**
* Load a user via the user credentials.
*

	/**
* Load a user via the user credentials.
*

	 * @param int The user id.
* @param string The user's loginkey.


	 * @param int $uid The user id.
* @param string $loginkey The user's loginkey.
* @return bool

	 */
function load_user($uid, $loginkey='')
{

	 */
function load_user($uid, $loginkey='')
{

		global $mybb, $db, $time, $lang, $mybbgroups, $session, $cache;

		global $mybb, $db, $time, $lang, $mybbgroups, $cache;


// Read the banned cache
$bannedcache = $cache->read("banned");


// Read the banned cache
$bannedcache = $cache->read("banned");

Zeile 125Zeile 144
		}

// Check the password if we're not using a session

		}

// Check the password if we're not using a session

		if(empty($loginkey) || $loginkey != $mybb->user['loginkey'] || !$mybb->user['uid'])

		if(empty($loginkey) || $loginkey !== $mybb->user['loginkey'] || !$mybb->user['uid'])

		{
unset($mybb->user);
$this->uid = 0;

		{
unset($mybb->user);
$this->uid = 0;

Zeile 304Zeile 323
		// Set up some defaults
$time = TIME_NOW;
$mybb->user['usergroup'] = 1;

		// Set up some defaults
$time = TIME_NOW;
$mybb->user['usergroup'] = 1;

		$mybb->user['username'] = '';
$mybb->user['uid'] = 0;


		$mybb->user['additionalgroups'] = '';
$mybb->user['username'] = '';
$mybb->user['uid'] = 0;

		$mybbgroups = 1;
$mybb->user['displaygroup'] = 1;


		$mybbgroups = 1;
$mybb->user['displaygroup'] = 1;


Zeile 320Zeile 340
			else
{
$mybb->user['lastactive'] = (int)$mybb->cookies['mybb']['lastactive'];

			else
{
$mybb->user['lastactive'] = (int)$mybb->cookies['mybb']['lastactive'];

			}

			}

			if($time - $mybb->cookies['mybb']['lastactive'] > 900)
{
my_setcookie("mybb[lastvisit]", $mybb->user['lastactive']);
$mybb->user['lastvisit'] = $mybb->user['lastactive'];

			if($time - $mybb->cookies['mybb']['lastactive'] > 900)
{
my_setcookie("mybb[lastvisit]", $mybb->user['lastactive']);
$mybb->user['lastvisit'] = $mybb->user['lastactive'];

			}

			}

			else
{
$mybb->user['lastvisit'] = (int)$mybb->cookies['mybb']['lastactive'];
}

			else
{
$mybb->user['lastvisit'] = (int)$mybb->cookies['mybb']['lastactive'];
}

		}

		}


// No last visit cookie, create one.
else


// No last visit cookie, create one.
else

Zeile 345Zeile 365
		// Gather a full permission set for this guest
$mybb->usergroup = usergroup_permissions($mybbgroups);
$mydisplaygroup = usergroup_displaygroup($mybb->user['displaygroup']);

		// Gather a full permission set for this guest
$mybb->usergroup = usergroup_permissions($mybbgroups);
$mydisplaygroup = usergroup_displaygroup($mybb->user['displaygroup']);


$mybb->usergroup = array_merge($mybb->usergroup, $mydisplaygroup);



		if(is_array($mydisplaygroup))
{
$mybb->usergroup = array_merge($mybb->usergroup, $mydisplaygroup);
}


// Update the online data.
if(!defined("NO_ONLINE") && !defined('IN_UPGRADE'))


// Update the online data.
if(!defined("NO_ONLINE") && !defined('IN_UPGRADE'))

Zeile 365Zeile 387
	/**
* Load a search engine spider.
*

	/**
* Load a search engine spider.
*

	 * @param int The ID of the search engine spider

	 * @param int $spider_id The ID of the search engine spider

	 */
function load_spider($spider_id)
{

	 */
function load_spider($spider_id)
{

Zeile 405Zeile 427
		// Gather a full permission set for this spider.
$mybb->usergroup = usergroup_permissions($mybb->user['usergroup']);
$mydisplaygroup = usergroup_displaygroup($mybb->user['displaygroup']);

		// Gather a full permission set for this spider.
$mybb->usergroup = usergroup_permissions($mybb->user['usergroup']);
$mydisplaygroup = usergroup_displaygroup($mybb->user['displaygroup']);

		$mybb->usergroup = array_merge($mybb->usergroup, $mydisplaygroup);




		if(is_array($mydisplaygroup))
{
$mybb->usergroup = array_merge($mybb->usergroup, $mydisplaygroup);
}


// Update spider last minute (only do so on two minute intervals - decrease load for quick spiders)
if($spider['lastvisit'] < TIME_NOW-120)


// Update spider last minute (only do so on two minute intervals - decrease load for quick spiders)
if($spider['lastvisit'] < TIME_NOW-120)

Zeile 428Zeile 453
	/**
* Update a user session.
*

	/**
* Update a user session.
*

	 * @param int The session id.
* @param int The user id.

	 * @param int $sid The session id.
* @param int $uid The user id.

	 */

	 */

	function update_session($sid, $uid='')

	function update_session($sid, $uid=0)

	{
global $db;


	{
global $db;


Zeile 448Zeile 473
		$onlinedata['time'] = TIME_NOW;

$onlinedata['location'] = $db->escape_string(substr(get_current_location(), 0, 150));

		$onlinedata['time'] = TIME_NOW;

$onlinedata['location'] = $db->escape_string(substr(get_current_location(), 0, 150));

		$onlinedata['useragent'] = $db->escape_string(my_substr($this->useragent, 0, 100));

		$onlinedata['useragent'] = $db->escape_string(my_substr($this->useragent, 0, 200));

		
$onlinedata['location1'] = (int)$speciallocs['1'];
$onlinedata['location2'] = (int)$speciallocs['2'];

		
$onlinedata['location1'] = (int)$speciallocs['1'];
$onlinedata['location2'] = (int)$speciallocs['2'];

Zeile 461Zeile 486
	/**
* Create a new session.
*

	/**
* Create a new session.
*

	 * @param int The user id to bind the session to.

	 * @param int $uid The user id to bind the session to.

	 */
function create_session($uid=0)
{

	 */
function create_session($uid=0)
{

Zeile 479Zeile 504
		{
$db->delete_query("sessions", "sid='{$this->sid}'");
}

		{
$db->delete_query("sessions", "sid='{$this->sid}'");
}

		// Else delete by ip.

 
		else
{

		else
{

			$db->delete_query("sessions", "ip=".$db->escape_binary($this->packedip));

 
			$onlinedata['uid'] = 0;
}


			$onlinedata['uid'] = 0;
}


Zeile 493Zeile 516
		}
else
{

		}
else
{

			$onlinedata['sid'] = md5(uniqid(microtime(true), true));

			$onlinedata['sid'] = md5(random_str(50));

		}
$onlinedata['time'] = TIME_NOW;
$onlinedata['ip'] = $db->escape_binary($this->packedip);

$onlinedata['location'] = $db->escape_string(substr(get_current_location(), 0, 150));

		}
$onlinedata['time'] = TIME_NOW;
$onlinedata['ip'] = $db->escape_binary($this->packedip);

$onlinedata['location'] = $db->escape_string(substr(get_current_location(), 0, 150));

		$onlinedata['useragent'] = $db->escape_string(my_substr($this->useragent, 0, 100));

		$onlinedata['useragent'] = $db->escape_string(my_substr($this->useragent, 0, 200));

		
$onlinedata['location1'] = (int)$speciallocs['1'];
$onlinedata['location2'] = (int)$speciallocs['2'];

		
$onlinedata['location1'] = (int)$speciallocs['1'];
$onlinedata['location2'] = (int)$speciallocs['2'];

Zeile 518Zeile 541
	{
global $mybb;
$array = array('1' => '', '2' => '');

	{
global $mybb;
$array = array('1' => '', '2' => '');

		if(preg_match("#forumdisplay.php#", $_SERVER['PHP_SELF']) && $mybb->get_input('fid', MyBB::INPUT_INT) > 0)

		if(preg_match("#forumdisplay.php#", $_SERVER['PHP_SELF']) && $mybb->get_input('fid', MyBB::INPUT_INT) > 0 && $mybb->get_input('fid', MyBB::INPUT_INT) < 4294967296)

		{
$array[1] = $mybb->get_input('fid', MyBB::INPUT_INT);
$array[2] = '';

		{
$array[1] = $mybb->get_input('fid', MyBB::INPUT_INT);
$array[2] = '';

Zeile 527Zeile 550
		{
global $db;


		{
global $db;


			if($mybb->get_input('tid', MyBB::INPUT_INT) > 0)

			if($mybb->get_input('tid', MyBB::INPUT_INT) > 0 && $mybb->get_input('tid', MyBB::INPUT_INT) < 4294967296)

			{
$array[2] = $mybb->get_input('tid', MyBB::INPUT_INT);
}

			{
$array[2] = $mybb->get_input('tid', MyBB::INPUT_INT);
}