Zeile 29 | Zeile 29 |
---|
// Find out the user agent. $this->useragent = $_SERVER['HTTP_USER_AGENT'];
|
// Find out the user agent. $this->useragent = $_SERVER['HTTP_USER_AGENT'];
|
if(my_strlen($this->useragent) > 100) { $this->useragent = my_substr($this->useragent, 0, 100); }
|
|
// Attempt to find a session id in the cookies. if(isset($mybb->cookies['sid'])) { $sid = $db->escape_string($mybb->cookies['sid']); // Load the session
|
// Attempt to find a session id in the cookies. if(isset($mybb->cookies['sid'])) { $sid = $db->escape_string($mybb->cookies['sid']); // Load the session
|
$query = $db->simple_select("sessions", "*", "sid='{$sid}' AND ip='".$db->escape_string($this->ipaddress)."'", array('limit' => 1));
| $query = $db->simple_select("sessions", "*", "sid='{$sid}' AND ip='".$db->escape_string($this->ipaddress)."'");
|
$session = $db->fetch_array($query); if($session['sid']) {
| $session = $db->fetch_array($query); if($session['sid']) {
|
Zeile 82 | Zeile 78 |
---|
// As a token of our appreciation for getting this far (and they aren't a spider), give the user a cookie
|
// As a token of our appreciation for getting this far (and they aren't a spider), give the user a cookie
|
if($this->sid && (isset($mybb->cookies['sid'] ) && $mybb->cookies['sid'] != $this->sid) && $this->is_spider != true)
| if($this->sid && (!isset($mybb->cookies['sid']) || $mybb->cookies['sid'] != $this->sid) && $this->is_spider != true)
|
{ my_setcookie("sid", $this->sid, -1, true); }
| { my_setcookie("sid", $this->sid, -1, true); }
|
Zeile 90 | Zeile 86 |
---|
/** * Load a user via the user credentials.
|
/** * Load a user via the user credentials.
|
* * @param int The user id. * @param string The user's password. */ function load_user($uid, $password='')
| * * @param int The user id. * @param string The user's loginkey. */ function load_user($uid, $loginkey='')
|
{ global $mybb, $db, $time, $lang, $mybbgroups, $session, $cache;
|
{ global $mybb, $db, $time, $lang, $mybbgroups, $session, $cache;
|
|
|
// Read the banned cache
|
// Read the banned cache
|
$bannedcache = $cache->read("banned");
| $bannedcache = $cache->read("banned");
|
// If the banned cache doesn't exist, update it and re-read it if(!is_array($bannedcache)) { $cache->update_banned(); $bannedcache = $cache->read("banned"); }
|
// If the banned cache doesn't exist, update it and re-read it if(!is_array($bannedcache)) { $cache->update_banned(); $bannedcache = $cache->read("banned"); }
|
|
|
$uid = intval($uid); $query = $db->query(" SELECT u.*, f.*
|
$uid = intval($uid); $query = $db->query(" SELECT u.*, f.*
|
FROM ".TABLE_PREFIX."users u LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid)
| FROM ".TABLE_PREFIX."users u LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid)
|
WHERE u.uid='$uid' LIMIT 1 "); $mybb->user = $db->fetch_array($query);
|
WHERE u.uid='$uid' LIMIT 1 "); $mybb->user = $db->fetch_array($query);
|
|
|
if(!empty($bannedcache[$uid])) { $banned_user = $bannedcache[$uid];
| if(!empty($bannedcache[$uid])) { $banned_user = $bannedcache[$uid];
|
Zeile 129 | Zeile 125 |
---|
}
// Check the password if we're not using a session
|
}
// Check the password if we're not using a session
|
if($password != $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 222 | Zeile 218 |
---|
{ $mybb->settings['postsperpage'] = $mybb->user['ppp']; }
|
{ $mybb->settings['postsperpage'] = $mybb->user['ppp']; }
|
|
|
// Does this user prefer posts in classic mode? if($mybb->user['classicpostbit']) { $mybb->settings['postlayout'] = 'classic'; } else
|
// Does this user prefer posts in classic mode? if($mybb->user['classicpostbit']) { $mybb->settings['postlayout'] = 'classic'; } else
|
{
| {
|
$mybb->settings['postlayout'] = 'horizontal'; }
// Check if this user is currently banned and if we have to lift it. if(!empty($mybb->user['bandate']) && (isset($mybb->user['banlifted']) && !empty($mybb->user['banlifted'])) && $mybb->user['banlifted'] < $time) // hmmm...bad user... how did you get banned =/
|
$mybb->settings['postlayout'] = 'horizontal'; }
// Check if this user is currently banned and if we have to lift it. if(!empty($mybb->user['bandate']) && (isset($mybb->user['banlifted']) && !empty($mybb->user['banlifted'])) && $mybb->user['banlifted'] < $time) // hmmm...bad user... how did you get banned =/
|
{
| {
|
// must have been good.. bans up :D
|
// must have been good.. bans up :D
|
$db->shutdown_query("UPDATE ".TABLE_PREFIX."users SET usergroup='".intval($mybb->user['banoldgroup'])."', additionalgroups='".$mybb->user['oldadditionalgroups']."', displaygroup='".intval($mybb->user['olddisplaygroup'])."' WHERE uid='".$mybb->user['uid']."' LIMIT 1");
| $db->shutdown_query("UPDATE ".TABLE_PREFIX."users SET usergroup='".intval($mybb->user['banoldgroup'])."', additionalgroups='".$mybb->user['banoldadditionalgroups']."', displaygroup='".intval($mybb->user['banolddisplaygroup'])."' WHERE uid='".$mybb->user['uid']."'");
|
$db->shutdown_query("DELETE FROM ".TABLE_PREFIX."banned WHERE uid='".$mybb->user['uid']."'"); // we better do this..otherwise they have dodgy permissions $mybb->user['usergroup'] = $mybb->user['banoldgroup']; $mybb->user['displaygroup'] = $mybb->user['banolddisplaygroup']; $mybb->user['additionalgroups'] = $mybb->user['banoldadditionalgroups']; $cache->update_banned();
|
$db->shutdown_query("DELETE FROM ".TABLE_PREFIX."banned WHERE uid='".$mybb->user['uid']."'"); // we better do this..otherwise they have dodgy permissions $mybb->user['usergroup'] = $mybb->user['banoldgroup']; $mybb->user['displaygroup'] = $mybb->user['banolddisplaygroup']; $mybb->user['additionalgroups'] = $mybb->user['banoldadditionalgroups']; $cache->update_banned();
|
$mybbgroups = $mybb->user['usergroup']; if($mybb->user['additionalgroups']) { $mybbgroups .= ','.$mybb->user['additionalgroups']; }
| $mybbgroups = $mybb->user['usergroup']; if($mybb->user['additionalgroups']) { $mybbgroups .= ','.$mybb->user['additionalgroups']; }
|
} else if(!empty($mybb->user['bandate']) && (empty($mybb->user['banlifted']) || !empty($mybb->user['banlifted']) && $mybb->user['banlifted'] > $time)) {
| } else if(!empty($mybb->user['bandate']) && (empty($mybb->user['banlifted']) || !empty($mybb->user['banlifted']) && $mybb->user['banlifted'] > $time)) {
|
Zeile 269 | Zeile 265 |
---|
if(!$mybb->user['displaygroup']) { $mybb->user['displaygroup'] = $mybb->user['usergroup'];
|
if(!$mybb->user['displaygroup']) { $mybb->user['displaygroup'] = $mybb->user['usergroup'];
|
}
| }
|
$mydisplaygroup = usergroup_displaygroup($mybb->user['displaygroup']); if(is_array($mydisplaygroup)) { $mybb->usergroup = array_merge($mybb->usergroup, $mydisplaygroup); }
|
$mydisplaygroup = usergroup_displaygroup($mybb->user['displaygroup']); if(is_array($mydisplaygroup)) { $mybb->usergroup = array_merge($mybb->usergroup, $mydisplaygroup); }
|
|
|
if(!$mybb->user['usertitle']) { $mybb->user['usertitle'] = $mybb->usergroup['usertitle'];
| if(!$mybb->user['usertitle']) { $mybb->user['usertitle'] = $mybb->usergroup['usertitle'];
|
Zeile 341 | Zeile 337 |
---|
{ my_setcookie("mybb[lastvisit]", $time); $mybb->user['lastvisit'] = $time;
|
{ my_setcookie("mybb[lastvisit]", $time); $mybb->user['lastvisit'] = $time;
|
}
| }
|
// Update last active cookie. my_setcookie("mybb[lastactive]", $time);
|
// Update last active cookie. my_setcookie("mybb[lastactive]", $time);
|
|
|
// 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);
// Update the online data.
| $mybb->usergroup = array_merge($mybb->usergroup, $mydisplaygroup);
// Update the online data.
|
Zeile 365 | Zeile 361 |
---|
} } }
|
} } }
|
|
|
/** * Load a search engine spider. *
| /** * Load a search engine spider. *
|
Zeile 376 | Zeile 372 |
---|
global $mybb, $time, $db, $lang;
// Fetch the spider preferences from the database
|
global $mybb, $time, $db, $lang;
// Fetch the spider preferences from the database
|
$query = $db->simple_select("spiders", "*", "sid='{$spider_id}'", array('limit' => 1));
| $query = $db->simple_select("spiders", "*", "sid='{$spider_id}'");
|
$spider = $db->fetch_array($query);
// Set up some defaults
| $spider = $db->fetch_array($query);
// Set up some defaults
|
Zeile 402 | Zeile 398 |
---|
// Set spider theme if($spider['theme'])
|
// Set spider theme if($spider['theme'])
|
{
| {
|
$mybb->user['style'] = $spider['theme']; }
| $mybb->user['style'] = $spider['theme']; }
|
Zeile 410 | Zeile 406 |
---|
$mybb->usergroup = usergroup_permissions($mybb->user['usergroup']); $mydisplaygroup = usergroup_displaygroup($mybb->user['displaygroup']); $mybb->usergroup = array_merge($mybb->usergroup, $mydisplaygroup);
|
$mybb->usergroup = usergroup_permissions($mybb->user['usergroup']); $mydisplaygroup = usergroup_displaygroup($mybb->user['displaygroup']); $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) { $updated_spider = array( "lastvisit" => TIME_NOW );
|
// Update spider last minute (only do so on two minute intervals - decrease load for quick spiders) if($spider['lastvisit'] < TIME_NOW-120) { $updated_spider = array( "lastvisit" => TIME_NOW );
|
$db->update_query("spiders", $updated_spider, "sid='{$spider_id}'", 1); }
| $db->update_query("spiders", $updated_spider, "sid='{$spider_id}'"); }
|
// Update the online data. if(!defined("NO_ONLINE")) { $this->sid = "bot=".$spider_id; $this->create_session();
|
// Update the online data. if(!defined("NO_ONLINE")) { $this->sid = "bot=".$spider_id; $this->create_session();
|
}
| }
|
}
/**
| }
/**
|
Zeile 448 | Zeile 444 |
---|
else { $onlinedata['uid'] = 0;
|
else { $onlinedata['uid'] = 0;
|
}
| }
|
$onlinedata['time'] = TIME_NOW; $onlinedata['location'] = $db->escape_string(get_current_location());
|
$onlinedata['time'] = TIME_NOW; $onlinedata['location'] = $db->escape_string(get_current_location());
|
$onlinedata['useragent'] = $db->escape_string($this->useragent);
| $useragent = $this->useragent; if(my_strlen($useragent) > 100) { $useragent = my_substr($useragent, 0, 100); } $onlinedata['useragent'] = $db->escape_string($useragent);
|
$onlinedata['location1'] = intval($speciallocs['1']); $onlinedata['location2'] = intval($speciallocs['2']); $onlinedata['nopermission'] = 0; $sid = $db->escape_string($sid);
|
$onlinedata['location1'] = intval($speciallocs['1']); $onlinedata['location2'] = intval($speciallocs['2']); $onlinedata['nopermission'] = 0; $sid = $db->escape_string($sid);
|
$db->update_query("sessions", $onlinedata, "sid='{$sid}'", 1);
| $db->update_query("sessions", $onlinedata, "sid='{$sid}'");
|
}
/** * Create a new session. * * @param int The user id to bind the session to.
|
}
/** * Create a new session. * * @param int The user id to bind the session to.
|
*/
| */
|
function create_session($uid=0) { global $db;
| function create_session($uid=0) { global $db;
|
Zeile 472 | Zeile 473 |
---|
// If there is a proper uid, delete by uid. if($uid > 0)
|
// If there is a proper uid, delete by uid. if($uid > 0)
|
{
| {
|
$db->delete_query("sessions", "uid='{$uid}'"); $onlinedata['uid'] = $uid; }
| $db->delete_query("sessions", "uid='{$uid}'"); $onlinedata['uid'] = $uid; }
|
Zeile 486 | Zeile 487 |
---|
{ $db->delete_query("sessions", "ip='".$db->escape_string($this->ipaddress)."'"); $onlinedata['uid'] = 0;
|
{ $db->delete_query("sessions", "ip='".$db->escape_string($this->ipaddress)."'"); $onlinedata['uid'] = 0;
|
}
| }
|
// If the user is a search enginge spider, ... if($this->is_spider == true) { $onlinedata['sid'] = $this->sid; } else
|
// If the user is a search enginge spider, ... if($this->is_spider == true) { $onlinedata['sid'] = $this->sid; } else
|
{
| {
|
$onlinedata['sid'] = md5(uniqid(microtime(true)));
|
$onlinedata['sid'] = md5(uniqid(microtime(true)));
|
}
| }
|
$onlinedata['time'] = TIME_NOW; $onlinedata['ip'] = $db->escape_string($this->ipaddress); $onlinedata['location'] = $db->escape_string(get_current_location());
|
$onlinedata['time'] = TIME_NOW; $onlinedata['ip'] = $db->escape_string($this->ipaddress); $onlinedata['location'] = $db->escape_string(get_current_location());
|
$onlinedata['useragent'] = $db->escape_string($this->useragent);
| $useragent = $this->useragent; if(my_strlen($useragent) > 100) { $useragent = my_substr($useragent, 0, 100); } $onlinedata['useragent'] = $db->escape_string($useragent);
|
$onlinedata['location1'] = intval($speciallocs['1']); $onlinedata['location2'] = intval($speciallocs['2']); $onlinedata['nopermission'] = 0;
| $onlinedata['location1'] = intval($speciallocs['1']); $onlinedata['location2'] = intval($speciallocs['2']); $onlinedata['nopermission'] = 0;
|
Zeile 523 | Zeile 529 |
---|
$array[1] = intval($mybb->input['fid']); $array[2] = ''; }
|
$array[1] = intval($mybb->input['fid']); $array[2] = ''; }
|
elseif(preg_match("#showthread.php#", $_SERVER['PHP_SELF']) && intval($mybb->input['tid']) > 0)
| elseif(preg_match("#showthread.php#", $_SERVER['PHP_SELF']))
|
{ global $db;
|
{ global $db;
|
$array[2] = intval($mybb->input['tid']); $thread = get_thread(intval($array[2]));
| if(isset($mybb->input['tid']) && intval($mybb->input['tid']) > 0) { $array[2] = intval($mybb->input['tid']); } // If there is no tid but a pid, trick the system into thinking there was a tid anyway. elseif(isset($mybb->input['pid']) && !empty($mybb->input['pid'])) { $options = array( "limit" => 1 ); $query = $db->simple_select("posts", "tid", "pid=".$mybb->input['pid'], $options); $post = $db->fetch_array($query); $array[2] = $post['tid']; }
$thread = get_thread($array[2]);
|
$array[1] = $thread['fid']; } return $array;
| $array[1] = $thread['fid']; } return $array;
|