Zeile 3 | Zeile 3 |
---|
* MyBB 1.2 * Copyright � 2006 MyBB Group, All Rights Reserved *
|
* MyBB 1.2 * Copyright � 2006 MyBB Group, All Rights Reserved *
|
* Website: http://www.mybboard.com * License: http://www.mybboard.com/eula.html
| * Website: http://www.mybboard.net * License: http://www.mybboard.net/eula.html
|
*
|
*
|
* $Id: user.php 2280 2006-09-27 12:21:17Z chris $
| * $Id: user.php 3514 2007-11-24 09:02:58Z Tikitiki $
|
*/
|
*/
|
| // Disallow direct access to this file for security reasons if(!defined("IN_MYBB")) { die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined."); }
|
/** * User handling class, provides common structure to handle user data.
| /** * User handling class, provides common structure to handle user data.
|
Zeile 24 | Zeile 30 |
---|
/** * The prefix for the language variables used in the data handler.
|
/** * The prefix for the language variables used in the data handler.
|
*
| *
|
* @var string */ var $language_prefix = 'userdata'; /** * Array of data inserted in to a user.
|
* @var string */ var $language_prefix = 'userdata'; /** * Array of data inserted in to a user.
|
* * @var array
| * * @var array
|
*/ var $user_insert_data = array();
| */ var $user_insert_data = array();
|
Zeile 40 | Zeile 46 |
---|
* Array of data used to update a user. * * @var array
|
* Array of data used to update a user. * * @var array
|
*/
| */
|
var $user_update_data = array(); /**
| var $user_update_data = array(); /**
|
Zeile 63 | Zeile 69 |
---|
require_once MYBB_ROOT.'inc/functions_user.php';
// Fix bad characters
|
require_once MYBB_ROOT.'inc/functions_user.php';
// Fix bad characters
|
$username = str_replace(array(chr(160), chr(173)), array(" ", "-"), $username);
| $username = trim($username); $username = str_replace(array(unicode_chr(160), unicode_chr(173), unicode_chr(0xCA), dec_to_utf8(8238), dec_to_utf8(8237)), array(" ", "-", "", "", ""), $username);
|
// Remove multiple spaces from the username $username = preg_replace("#\s{2,}#", " ", $username);
// Check if the username is not empty.
|
// Remove multiple spaces from the username $username = preg_replace("#\s{2,}#", " ", $username);
// Check if the username is not empty.
|
if(trim($username) == '')
| if($username == '')
|
{ $this->set_error('missing_username');
|
{ $this->set_error('missing_username');
|
return false; }
| return false; }
|
// Check if the username belongs to the list of banned usernames.
|
// Check if the username belongs to the list of banned usernames.
|
$bannedusernames = get_banned_usernames(); if(in_array($username, $bannedusernames))
| if(is_banned_username($username))
|
{ $this->set_error('banned_username');
|
{ $this->set_error('banned_username');
|
return false; }
| return false; }
|
// Check for certain characters in username (<, >, &, and slashes) if(eregi("<", $username) || eregi(">", $username) || eregi("&", $username) || strpos($username, "\\") !== false || eregi(";", $username))
| // Check for certain characters in username (<, >, &, and slashes) if(eregi("<", $username) || eregi(">", $username) || eregi("&", $username) || strpos($username, "\\") !== false || eregi(";", $username))
|
Zeile 91 | Zeile 97 |
---|
}
// Check if the username is of the correct length.
|
}
// Check if the username is of the correct length.
|
if(($mybb->settings['maxnamelength'] != 0 && my_strlen($username) > $mybb->settings['maxnamelength']) || ($mybb->settings['minnamelength'] != 0 && my_strlen($username) < $mybb->settings['minnamelength']) && !$bannedusername && !$missingname) {
| if(($mybb->settings['maxnamelength'] != 0 && my_strlen($username) > $mybb->settings['maxnamelength']) || ($mybb->settings['minnamelength'] != 0 && my_strlen($username) < $mybb->settings['minnamelength'])) {
|
$this->set_error('invalid_username_length', array($mybb->settings['minnamelength'], $mybb->settings['maxnamelength'])); return false; }
| $this->set_error('invalid_username_length', array($mybb->settings['minnamelength'], $mybb->settings['maxnamelength'])); return false; }
|
Zeile 111 | Zeile 117 |
---|
$username = &$this->data['username'];
|
$username = &$this->data['username'];
|
$query = $db->simple_select(TABLE_PREFIX."users", "COUNT(uid) AS count", "username='".$db->escape_string($username)."'");
| $query = $db->simple_select(TABLE_PREFIX."users", "COUNT(uid) AS count", "LOWER(username)='".$db->escape_string(strtolower(trim($username)))."' AND uid!='{$this->data['uid']}'");
|
$user_count = $db->fetch_field($query, "count"); if($user_count > 0) {
| $user_count = $db->fetch_field($query, "count"); if($user_count > 0) {
|
Zeile 139 | Zeile 145 |
---|
if(my_strlen($user['password']) < $mybb->settings['minpasswordlength']) { $this->set_error('invalid_password_length', array($mybb->settings['minpasswordlength'], $mybb->settings['maxpasswordlength']));
|
if(my_strlen($user['password']) < $mybb->settings['minpasswordlength']) { $this->set_error('invalid_password_length', array($mybb->settings['minpasswordlength'], $mybb->settings['maxpasswordlength']));
|
return false; }
| return false; }
|
// See if the board has "require complex passwords" enabled. if($mybb->settings['requirecomplexpasswords'] == "yes") {
| // See if the board has "require complex passwords" enabled. if($mybb->settings['requirecomplexpasswords'] == "yes") {
|
Zeile 150 | Zeile 156 |
---|
if(!preg_match('#[\W]+#', $user['password'])) { $this->set_error('no_complex_characters');
|
if(!preg_match('#[\W]+#', $user['password'])) { $this->set_error('no_complex_characters');
|
return false; } }
| return false; } }
|
// If we have a "password2" check if they both match if(isset($user['password2']) && $user['password'] != $user['password2']) {
| // If we have a "password2" check if they both match if(isset($user['password2']) && $user['password'] != $user['password2']) {
|
Zeile 168 | Zeile 174 |
---|
if(!$user['salt']) { $user['salt'] = generate_salt();
|
if(!$user['salt']) { $user['salt'] = generate_salt();
|
}
| }
|
// Combine the password and salt $user['saltedpw'] = salt_password($user['md5password'], $user['salt']);
|
// Combine the password and salt $user['saltedpw'] = salt_password($user['md5password'], $user['salt']);
|
|
|
// Generate the user login key $user['loginkey'] = generate_loginkey();
| // Generate the user login key $user['loginkey'] = generate_loginkey();
|
Zeile 181 | Zeile 187 |
---|
/** * Verifies usergroup selections and other group details.
|
/** * Verifies usergroup selections and other group details.
|
* * @return boolean True when valid, false when invalid. */
| * * @return boolean True when valid, false when invalid. */
|
function verify_usergroup()
|
function verify_usergroup()
|
{
| {
|
$user = &$this->data; return true; }
| $user = &$this->data; return true; }
|
Zeile 197 | Zeile 203 |
---|
function verify_email() { global $mybb;
|
function verify_email() { global $mybb;
|
$user = &$this->data;
| $user = &$this->data;
|
// Check if an email address has actually been entered. if(trim($user['email']) == '')
| // Check if an email address has actually been entered. if(trim($user['email']) == '')
|
Zeile 208 | Zeile 214 |
---|
}
// Check if this is a proper email address.
|
}
// Check if this is a proper email address.
|
if(validate_email_format($user['email']) === false)
| if(!validate_email_format($user['email']))
|
{ $this->set_error('invalid_email_format'); return false; }
// Check banned emails
|
{ $this->set_error('invalid_email_format'); return false; }
// Check banned emails
|
$bannedemails = explode(" ", $mybb->settings['bannedemails']); if(is_array($bannedemails))
| if(is_banned_email($user['email']))
|
{
|
{
|
foreach($bannedemails as $bannedemail) { $bannedemail = strtolower(trim($bannedemail)); if($bannedemail != '') { if(strstr($user['email'], $bannedemail) != '') { $this->set_error('banned_email'); return false; } } }
| $this->set_error('banned_email'); return false;
|
}
// If we have an "email2", verify it matches the existing email
| }
// If we have an "email2", verify it matches the existing email
|
Zeile 272 | Zeile 267 |
---|
/** * Verifies if an ICQ number is valid or not.
|
/** * Verifies if an ICQ number is valid or not.
|
* * @return boolean True when valid, false when invalid.
| * * @return boolean True when valid, false when invalid.
|
*/ function verify_icq() {
| */ function verify_icq() {
|
Zeile 300 | Zeile 295 |
---|
if($msn != '' && validate_email_format($msn) == false) { $this->set_error("invalid_msn_address");
|
if($msn != '' && validate_email_format($msn) == false) { $this->set_error("invalid_msn_address");
|
return false; } return true; }
/**
| return false; } return true; }
/**
|
* Verifies if a birthday is valid or not. * * @return boolean True when valid, false when invalid.
| * Verifies if a birthday is valid or not. * * @return boolean True when valid, false when invalid.
|
Zeile 352 | Zeile 347 |
---|
// Make the user's birthday field if($birthday['year'] != 0)
|
// Make the user's birthday field if($birthday['year'] != 0)
|
{
| {
|
// If the year is specified, put together a d-m-y string $user['bday'] = $birthday['day']."-".$birthday['month']."-".$birthday['year']; } elseif($birthday['day'] && $birthday['month']) { // If only a day and month are specified, put together a d-m string
|
// If the year is specified, put together a d-m-y string $user['bday'] = $birthday['day']."-".$birthday['month']."-".$birthday['year']; } elseif($birthday['day'] && $birthday['month']) { // If only a day and month are specified, put together a d-m string
|
$user['bday'] = $birthday['day']."-".$birthday['month'];
| $user['bday'] = $birthday['day']."-".$birthday['month']."-";
|
} else {
| } else {
|
Zeile 368 | Zeile 363 |
---|
} return true; }
|
} return true; }
|
|
|
/** * Verifies if a profile fields are filled in correctly. *
| /** * Verifies if a profile fields are filled in correctly. *
|
Zeile 384 | Zeile 379 |
---|
// Loop through profile fields checking if they exist or not and are filled in. $userfields = array(); $comma = '';
|
// Loop through profile fields checking if they exist or not and are filled in. $userfields = array(); $comma = '';
|
| $editable = ''; if(!$this->data['profile_fields_editable']) { $editable = "editable='yes'"; }
|
// Fetch all profile fields first. $options = array( 'order_by' => 'disporder' );
|
// Fetch all profile fields first. $options = array( 'order_by' => 'disporder' );
|
$query = $db->simple_select(TABLE_PREFIX.'profilefields', 'name, type, fid, required', "editable='yes'", $options);
| $query = $db->simple_select(TABLE_PREFIX.'profilefields', 'name, type, fid, required', $editable, $options);
|
// Then loop through the profile fields. while($profilefield = $db->fetch_array($query))
| // Then loop through the profile fields. while($profilefield = $db->fetch_array($query))
|
Zeile 400 | Zeile 401 |
---|
$field = "fid{$profilefield['fid']}";
// If the profile field is required, but not filled in, present error.
|
$field = "fid{$profilefield['fid']}";
// If the profile field is required, but not filled in, present error.
|
if(!$profile_fields[$field] && $profilefield['required'] == "yes" && !$proferror) {
| if(trim($profile_fields[$field]) == "" && $profilefield['required'] == "yes" && !defined('IN_ADMINCP')) {
|
$this->set_error('missing_required_profile_field', array($profilefield['name'])); }
| $this->set_error('missing_required_profile_field', array($profilefield['name'])); }
|
Zeile 416 | Zeile 417 |
---|
if(!in_array($value, $expoptions)) { $this->set_error('bad_profile_field_values', array($profilefield['name']));
|
if(!in_array($value, $expoptions)) { $this->set_error('bad_profile_field_values', array($profilefield['name']));
|
}
| }
|
if($options) { $options .= "\n";
| if($options) { $options .= "\n";
|
Zeile 431 | Zeile 432 |
---|
if(!in_array(htmlspecialchars_uni($profile_fields[$field]), $expoptions) && $profile_fields[$field] != "") { $this->set_error('bad_profile_field_values', array($profilefield['name']));
|
if(!in_array(htmlspecialchars_uni($profile_fields[$field]), $expoptions) && $profile_fields[$field] != "") { $this->set_error('bad_profile_field_values', array($profilefield['name']));
|
} $options = $db->escape_string($profile_fields[$field]);
| } $options = $db->escape_string($profile_fields[$field]);
|
} else {
| } else {
|
Zeile 440 | Zeile 441 |
---|
} $user['user_fields'][$field] = $options; }
|
} $user['user_fields'][$field] = $options; }
|
|
|
return true; }
/** * Verifies if an optionally entered referrer exists or not.
|
return true; }
/** * Verifies if an optionally entered referrer exists or not.
|
* * @return boolean True when valid, false when invalid.
| * * @return boolean True when valid, false when invalid.
|
*/ function verify_referrer() {
|
*/ function verify_referrer() {
|
global $db;
| global $db, $mybb;
|
$user = &$this->data;
| $user = &$this->data;
|
Zeile 487 | Zeile 488 |
---|
$this->verify_yesno_option($options, 'allownotices', 'yes'); $this->verify_yesno_option($options, 'hideemail', 'no'); $this->verify_yesno_option($options, 'emailnotify', 'no');
|
$this->verify_yesno_option($options, 'allownotices', 'yes'); $this->verify_yesno_option($options, 'hideemail', 'no'); $this->verify_yesno_option($options, 'emailnotify', 'no');
|
| $this->verify_yesno_option($options, 'emailpmnotify', 'no');
|
$this->verify_yesno_option($options, 'receivepms', 'yes'); $this->verify_yesno_option($options, 'pmpopup', 'yes'); $this->verify_yesno_option($options, 'pmnotify', 'yes');
| $this->verify_yesno_option($options, 'receivepms', 'yes'); $this->verify_yesno_option($options, 'pmpopup', 'yes'); $this->verify_yesno_option($options, 'pmnotify', 'yes');
|
Zeile 498 | Zeile 500 |
---|
$this->verify_yesno_option($options, 'showquickreply', 'yes'); $this->verify_yesno_option($options, 'showredirect', 'yes');
|
$this->verify_yesno_option($options, 'showquickreply', 'yes'); $this->verify_yesno_option($options, 'showredirect', 'yes');
|
$options['showcodebuttons'] = intval($options['showcodebuttons']); if($this->method == "insert" || (array_key_exists('showcodebuttons', $options) && $options['showcodebuttons'] != '0')) { $options['showcodebuttons'] = 1; }
| if(isset($options['showcodebuttons'])) { $options['showcodebuttons'] = intval($options['showcodebuttons']); if($options['showcodebuttons'] != 0) { $options['showcodebuttons'] = 1; } } else if($this->method == "insert") { $options['showcodebuttons'] = 1; }
|
if($this->method == "insert" || (isset($options['threadmode']) && $options['threadmode'] != "threaded")) { $options['threadmode'] = 'linear';
| if($this->method == "insert" || (isset($options['threadmode']) && $options['threadmode'] != "threaded")) { $options['threadmode'] = 'linear';
|
Zeile 513 | Zeile 523 |
---|
{ $explodedtpp = explode(",", $mybb->settings['usertppoptions']); if(is_array($explodedtpp))
|
{ $explodedtpp = explode(",", $mybb->settings['usertppoptions']); if(is_array($explodedtpp))
|
{
| {
|
@asort($explodedtpp); $biggest = $explodedtpp[count($explodedtpp)-1]; // Is the selected option greater than the allowed options?
| @asort($explodedtpp); $biggest = $explodedtpp[count($explodedtpp)-1]; // Is the selected option greater than the allowed options?
|
Zeile 529 | Zeile 539 |
---|
{ $explodedppp = explode(",", $mybb->settings['userpppoptions']); if(is_array($explodedppp))
|
{ $explodedppp = explode(",", $mybb->settings['userpppoptions']); if(is_array($explodedppp))
|
{
| {
|
@asort($explodedppp); $biggest = $explodedppp[count($explodedppp)-1]; // Is the selected option greater than the allowed options?
| @asort($explodedppp); $biggest = $explodedppp[count($explodedppp)-1]; // Is the selected option greater than the allowed options?
|
Zeile 573 | Zeile 583 |
---|
/** * Verifies if a last visit date is valid or not.
|
/** * Verifies if a last visit date is valid or not.
|
* * @return boolean True when valid, false when invalid. */
| * * @return boolean True when valid, false when invalid. */
|
function verify_lastvisit() { $lastvisit = &$this->data['lastvisit'];
| function verify_lastvisit() { $lastvisit = &$this->data['lastvisit'];
|
Zeile 585 | Zeile 595 |
---|
if($lastvisit <= 0) { $lastvisit = time();
|
if($lastvisit <= 0) { $lastvisit = time();
|
} return true;
}
/**
| } return true;
}
/**
|
* Verifies if a last active date is valid or not. * * @return boolean True when valid, false when invalid.
| * Verifies if a last active date is valid or not. * * @return boolean True when valid, false when invalid.
|
Zeile 606 | Zeile 616 |
---|
$lastactive = time(); } return true;
|
$lastactive = time(); } return true;
|
|
|
}
/**
| }
/**
|
Zeile 621 | Zeile 631 |
---|
$user = &$this->data; // If the board does not allow "away mode" or the user is marking as not away, set defaults. if($mybb->settings['allowaway'] == "no" || $user['away']['away'] != 'yes')
|
$user = &$this->data; // If the board does not allow "away mode" or the user is marking as not away, set defaults. if($mybb->settings['allowaway'] == "no" || $user['away']['away'] != 'yes')
|
{
| {
|
$user['away']['away'] = "no"; $user['away']['date'] = 0; $user['away']['returndate'] = 0;
| $user['away']['away'] = "no"; $user['away']['date'] = 0; $user['away']['returndate'] = 0;
|
Zeile 637 | Zeile 647 |
---|
} } }
|
} } }
|
|
|
/** * Verifies if a langage is valid for this user or not. *
| /** * Verifies if a langage is valid for this user or not. *
|
Zeile 653 | Zeile 663 |
---|
if($language != '' && !$lang->language_exists($language)) { $this->set_error("invalid_language");
|
if($language != '' && !$lang->language_exists($language)) { $this->set_error("invalid_language");
|
return false; }
| return false; }
|
return true; }
|
return true; }
|
|
|
/** * Validate all user assets. *
| /** * Validate all user assets. *
|
Zeile 666 | Zeile 676 |
---|
function validate_user() { global $mybb, $plugins;
|
function validate_user() { global $mybb, $plugins;
|
$user = &$this->data;
| $user = &$this->data;
|
// First, grab the old user details if this user exists if($user['uid'])
| // First, grab the old user details if this user exists if($user['uid'])
|
Zeile 675 | Zeile 685 |
---|
$old_user = get_user($user['uid']); }
|
$old_user = get_user($user['uid']); }
|
if($this->method == "insert" || array_key_exists('usernane', $user))
| if($this->method == "insert" || array_key_exists('username', $user))
|
{ // If the username is the same - no need to verify if(!$old_user['username'] || $user['username'] != $old_user['username']) { $this->verify_username(); $this->verify_username_exists();
|
{ // If the username is the same - no need to verify if(!$old_user['username'] || $user['username'] != $old_user['username']) { $this->verify_username(); $this->verify_username_exists();
|
}
| }
|
else { unset($user['username']); }
|
else { unset($user['username']); }
|
}
| }
|
if($this->method == "insert" || array_key_exists('password', $user))
|
if($this->method == "insert" || array_key_exists('password', $user))
|
{
| {
|
$this->verify_password();
|
$this->verify_password();
|
}
| }
|
if($this->method == "insert" || array_key_exists('usergroup', $user))
|
if($this->method == "insert" || array_key_exists('usergroup', $user))
|
{
| {
|
$this->verify_usergroup(); } if($this->method == "insert" || array_key_exists('email', $user))
|
$this->verify_usergroup(); } if($this->method == "insert" || array_key_exists('email', $user))
|
{
| {
|
$this->verify_email(); } if($this->method == "insert" || array_key_exists('website', $user)) { $this->verify_website();
|
$this->verify_email(); } if($this->method == "insert" || array_key_exists('website', $user)) { $this->verify_website();
|
}
| }
|
if($this->method == "insert" || array_key_exists('icq', $user))
|
if($this->method == "insert" || array_key_exists('icq', $user))
|
{
| {
|
$this->verify_icq();
|
$this->verify_icq();
|
}
| }
|
if($this->method == "insert" || array_key_exists('msn', $user)) { $this->verify_msn();
|
if($this->method == "insert" || array_key_exists('msn', $user)) { $this->verify_msn();
|
}
| }
|
if($this->method == "insert" || is_array($user['birthday'])) { $this->verify_birthday(); } if($this->method == "insert" || array_key_exists('profile_fields', $user))
|
if($this->method == "insert" || is_array($user['birthday'])) { $this->verify_birthday(); } if($this->method == "insert" || array_key_exists('profile_fields', $user))
|
{
| {
|
$this->verify_profile_fields();
|
$this->verify_profile_fields();
|
}
| }
|
if($this->method == "insert" || array_key_exists('referrer', $user))
|
if($this->method == "insert" || array_key_exists('referrer', $user))
|
{
| {
|
$this->verify_referrer(); } if($this->method == "insert" || array_key_exists('options', $user))
|
$this->verify_referrer(); } if($this->method == "insert" || array_key_exists('options', $user))
|
{
| {
|
$this->verify_options(); } if($this->method == "insert" || array_key_exists('regdate', $user))
| $this->verify_options(); } if($this->method == "insert" || array_key_exists('regdate', $user))
|
Zeile 753 | Zeile 763 |
---|
// We are done validating, return. $this->set_validated(true);
|
// We are done validating, return. $this->set_validated(true);
|
if(count($this->get_errors()) > 0) {
| if(count($this->get_errors()) > 0) {
|
return false;
|
return false;
|
}
| }
|
else
|
else
|
{
| {
|
return true;
|
return true;
|
}
| }
|
}
/**
| }
/**
|
Zeile 770 | Zeile 780 |
---|
{ global $db, $cache, $plugins;
|
{ global $db, $cache, $plugins;
|
// Yes, validating is required. if(!$this->get_validated()) { die("The user needs to be validated before inserting it into the DB."); } if(count($this->get_errors()) > 0) { die("The user is not valid."); }
$user = &$this->data;
| // Yes, validating is required. if(!$this->get_validated()) { die("The user needs to be validated before inserting it into the DB."); } if(count($this->get_errors()) > 0) { die("The user is not valid."); }
$user = &$this->data;
|
$this->user_insert_data = array( "username" => $db->escape_string($user['username']), "password" => $user['saltedpw'],
| $this->user_insert_data = array( "username" => $db->escape_string($user['username']), "password" => $user['saltedpw'],
|
Zeile 826 | Zeile 836 |
---|
"daysprune" => intval($user['options']['daysprune']), "dateformat" => $db->escape_string($user['dateformat']), "timeformat" => $db->escape_string($user['timeformat']),
|
"daysprune" => intval($user['options']['daysprune']), "dateformat" => $db->escape_string($user['dateformat']), "timeformat" => $db->escape_string($user['timeformat']),
|
"regip" => $user['regip'],
| "regip" => $db->escape_string($user['regip']),
|
"language" => $db->escape_string($user['language']), "showcodebuttons" => $user['options']['showcodebuttons'], "away" => $user['away']['away'],
| "language" => $db->escape_string($user['language']), "showcodebuttons" => $user['options']['showcodebuttons'], "away" => $user['away']['away'],
|
Zeile 834 | Zeile 844 |
---|
"returndate" => $user['away']['returndate'], "awayreason" => $db->escape_string($user['away']['awayreason']), "notepad" => $db->escape_string($user['notepad']),
|
"returndate" => $user['away']['returndate'], "awayreason" => $db->escape_string($user['away']['awayreason']), "notepad" => $db->escape_string($user['notepad']),
|
"referrer" => intval($user['referrer_uid'])
| "referrer" => intval($user['referrer_uid']), "buddylist" => '', "ignorelist" => '', "pmfolders" => '', "notepad" => ''
|
); $plugins->run_hooks_by_ref("datahandler_user_insert", $this);
| ); $plugins->run_hooks_by_ref("datahandler_user_insert", $this);
|
Zeile 843 | Zeile 857 |
---|
$this->uid = $db->insert_id();
$user['user_fields']['ufid'] = $this->uid;
|
$this->uid = $db->insert_id();
$user['user_fields']['ufid'] = $this->uid;
|
| $query = $db->query("SHOW FIELDS FROM ".TABLE_PREFIX."userfields"); while($field = $db->fetch_array($query)) { if($field['Field'] == 'ufid' || array_key_exists($field['Field'], $user['user_fields'])) { continue; } $user['user_fields'][$field['Field']] = ''; }
|
$db->insert_query(TABLE_PREFIX."userfields", $user['user_fields']);
// Update forum stats
|
$db->insert_query(TABLE_PREFIX."userfields", $user['user_fields']);
// Update forum stats
|
$cache->updatestats();
| update_stats(array('numusers' => '+1'));
|
return array( "uid" => $this->uid,
| return array( "uid" => $this->uid,
|
Zeile 893 | Zeile 918 |
---|
if(isset($user['email'])) { $this->user_update_data['email'] = $user['email'];
|
if(isset($user['email'])) { $this->user_update_data['email'] = $user['email'];
|
}
| }
|
if(isset($user['postnum']))
|
if(isset($user['postnum']))
|
{
| {
|
$this->user_update_data['postnum'] = intval($user['postnum']);
|
$this->user_update_data['postnum'] = intval($user['postnum']);
|
}
| }
|
if(isset($user['avatar']))
|
if(isset($user['avatar']))
|
{
| {
|
$this->user_update_data['avatar'] = $db->escape_string($user['avatar']); $this->user_update_data['avatartype'] = $db->escape_string($user['avatartype']); }
| $this->user_update_data['avatar'] = $db->escape_string($user['avatar']); $this->user_update_data['avatartype'] = $db->escape_string($user['avatartype']); }
|
Zeile 908 | Zeile 933 |
---|
$this->user_update_data['usergroup'] = intval($user['usergroup']); } if(isset($user['additionalgroups']))
|
$this->user_update_data['usergroup'] = intval($user['usergroup']); } if(isset($user['additionalgroups']))
|
{
| {
|
$this->user_update_data['additionalgroups'] = $db->escape_string($user['additionalgroups']);
|
$this->user_update_data['additionalgroups'] = $db->escape_string($user['additionalgroups']);
|
}
| }
|
if(isset($user['displaygroup']))
|
if(isset($user['displaygroup']))
|
{
| {
|
$this->user_update_data['displaygroup'] = intval($user['displaygroup']);
|
$this->user_update_data['displaygroup'] = intval($user['displaygroup']);
|
}
| }
|
if(isset($user['usertitle']))
|
if(isset($user['usertitle']))
|
{
| {
|
$this->user_update_data['usertitle'] = $db->escape_string(htmlspecialchars_uni($user['usertitle']));
|
$this->user_update_data['usertitle'] = $db->escape_string(htmlspecialchars_uni($user['usertitle']));
|
}
| }
|
if(isset($user['regdate'])) { $this->user_update_data['regdate'] = intval($user['regdate']); } if(isset($user['lastactive']))
|
if(isset($user['regdate'])) { $this->user_update_data['regdate'] = intval($user['regdate']); } if(isset($user['lastactive']))
|
{
| {
|
$this->user_update_data['lastactive'] = intval($user['lastactive']);
|
$this->user_update_data['lastactive'] = intval($user['lastactive']);
|
}
| }
|
if(isset($user['lastvisit']))
|
if(isset($user['lastvisit']))
|
{
| {
|
$this->user_update_data['lastvisit'] = intval($user['lastvisit']);
|
$this->user_update_data['lastvisit'] = intval($user['lastvisit']);
|
}
| }
|
if(isset($user['signature']))
|
if(isset($user['signature']))
|
{
| {
|
$this->user_update_data['signature'] = $db->escape_string($user['signature']);
|
$this->user_update_data['signature'] = $db->escape_string($user['signature']);
|
}
| }
|
if(isset($user['website'])) { $this->user_update_data['website'] = $db->escape_string(htmlspecialchars($user['website'])); } if(isset($user['icq']))
|
if(isset($user['website'])) { $this->user_update_data['website'] = $db->escape_string(htmlspecialchars($user['website'])); } if(isset($user['icq']))
|
{
| {
|
$this->user_update_data['icq'] = intval($user['icq']); } if(isset($user['aim']))
| $this->user_update_data['icq'] = intval($user['icq']); } if(isset($user['aim']))
|
Zeile 981 | Zeile 1006 |
---|
} if(isset($user['language'])) {
|
} if(isset($user['language'])) {
|
$this->user_update_data['language'] = $user['language'];
| $this->user_update_data['language'] = $db->escape_string($user['language']);
|
} if(isset($user['away'])) {
| } if(isset($user['away'])) {
|
Zeile 1006 | Zeile 1031 |
---|
$old_user = get_user($user['uid']);
$plugins->run_hooks_by_ref("datahandler_user_update", $this);
|
$old_user = get_user($user['uid']);
$plugins->run_hooks_by_ref("datahandler_user_update", $this);
|
| if(count($this->user_update_data) < 1) { return false; }
|
// Actual updating happens here. $db->update_query(TABLE_PREFIX."users", $this->user_update_data, "uid='{$user['uid']}'");
|
// Actual updating happens here. $db->update_query(TABLE_PREFIX."users", $this->user_update_data, "uid='{$user['uid']}'");
|
|
|
// Maybe some userfields need to be updated? if(is_array($user['user_fields'])) {
| // Maybe some userfields need to be updated? if(is_array($user['user_fields'])) {
|
Zeile 1017 | Zeile 1047 |
---|
$fields = $db->fetch_array($query); if(!$fields['ufid']) {
|
$fields = $db->fetch_array($query); if(!$fields['ufid']) {
|
$db->insert_query(TABLE_PREFIX."userfields", array('ufid' => $user['uid']));
| $user_fields = array( 'ufid' => $user['uid'] );
$query = $db->query("SHOW FIELDS FROM ".TABLE_PREFIX."userfields"); while($field = $db->fetch_array($query)) { if($field['Field'] == 'ufid') { continue; } $user_fields[$field['Field']] = ''; } $db->insert_query(TABLE_PREFIX."userfields", $user_fields);
|
} $db->update_query(TABLE_PREFIX."userfields", $user['user_fields'], "ufid='{$user['uid']}'"); }
| } $db->update_query(TABLE_PREFIX."userfields", $user['user_fields'], "ufid='{$user['uid']}'"); }
|
Zeile 1036 | Zeile 1079 |
---|
$db->update_query(TABLE_PREFIX."threads", $username_update, "uid='{$user['uid']}'"); $db->update_query(TABLE_PREFIX."threads", $lastposter_update, "lastposteruid='{$user['uid']}'"); $db->update_query(TABLE_PREFIX."forums", $lastposter_update, "lastposteruid='{$user['uid']}'");
|
$db->update_query(TABLE_PREFIX."threads", $username_update, "uid='{$user['uid']}'"); $db->update_query(TABLE_PREFIX."threads", $lastposter_update, "lastposteruid='{$user['uid']}'"); $db->update_query(TABLE_PREFIX."forums", $lastposter_update, "lastposteruid='{$user['uid']}'");
|
| global $cache; $stats = $cache->read("stats"); if($stats['lastuid'] == $user['uid']) { // User was latest to register, update stats update_stats(array("numusers" => "+0")); }
|
}
}
| }
}
|