Zeile 61 | Zeile 61 |
---|
* @var array */ public $return_values = array();
|
* @var array */ public $return_values = array();
|
| /** * @var array */ var $delete_uids = array();
/** * @var int */ var $deleted_users = 0;
|
/** * Verifies if a username is valid or invalid. *
|
/** * Verifies if a username is valid or invalid. *
|
* @param boolean True when valid, false when invalid.
| * @return boolean True when valid, false when invalid.
|
*/ function verify_username() {
| */ function verify_username() {
|
Zeile 106 | Zeile 116 |
---|
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']));
|
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; }
return true; }
/**
| return false; }
return true; }
/**
|
* Verifies if a usertitle is valid or invalid. *
|
* Verifies if a usertitle is valid or invalid. *
|
* @param boolean True when valid, false when invalid.
| * @return boolean True when valid, false when invalid.
|
*/ function verify_usertitle() {
| */ function verify_usertitle() {
|
Zeile 160 | Zeile 170 |
---|
/** * Verifies if a new password is valid or not.
|
/** * Verifies if a new password is valid or not.
|
* * @return boolean True when valid, false when invalid. */
| * * @return boolean True when valid, false when invalid. */
|
function verify_password() { global $mybb;
|
function verify_password() { global $mybb;
|
|
|
$user = &$this->data;
// Always check for the length of the password.
| $user = &$this->data;
// Always check for the length of the password.
|
Zeile 174 | Zeile 184 |
---|
{ $this->set_error('invalid_password_length', array($mybb->settings['minpasswordlength'], $mybb->settings['maxpasswordlength'])); return false;
|
{ $this->set_error('invalid_password_length', array($mybb->settings['minpasswordlength'], $mybb->settings['maxpasswordlength'])); return false;
|
}
| }
|
// Has the user tried to use their email address or username as a password?
|
// Has the user tried to use their email address or username as a password?
|
if($user['email'] === $user['password'] || $user['username'] === $user['password']) { $this->set_error('bad_password_security'); return false;
| if(!empty($user['email']) && !empty($user['username'])) { if($user['email'] === $user['password'] || $user['username'] === $user['password'] || strpos($user['password'], $user['email']) !== false || strpos($user['password'], $user['username']) !== false || strpos($user['email'], $user['password']) !== false || strpos($user['username'], $user['password']) !== false) { $this->set_error('bad_password_security'); return false; }
|
}
// See if the board has "require complex passwords" enabled.
| }
// See if the board has "require complex passwords" enabled.
|
Zeile 189 | Zeile 204 |
---|
// Complex passwords required, do some extra checks. // First, see if there is one or more complex character(s) in the password. if(!preg_match("/^.*(?=.{".$mybb->settings['minpasswordlength'].",})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $user['password']))
|
// Complex passwords required, do some extra checks. // First, see if there is one or more complex character(s) in the password. if(!preg_match("/^.*(?=.{".$mybb->settings['minpasswordlength'].",})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $user['password']))
|
{
| {
|
$this->set_error('no_complex_characters', array($mybb->settings['minpasswordlength'])); return false; }
|
$this->set_error('no_complex_characters', array($mybb->settings['minpasswordlength'])); 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 201 | Zeile 216 |
---|
$this->set_error("passwords_dont_match"); return false; }
|
$this->set_error("passwords_dont_match"); return false; }
|
// MD5 the password $user['md5password'] = md5($user['password']);
// Generate our salt $user['salt'] = generate_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();
|
| // Combine the password and salt $password_fields = create_password($user['password'], false, $user); $user = array_merge($user, $password_fields);
|
return true; }
| return true; }
|
Zeile 224 | Zeile 234 |
---|
*/ function verify_usergroup() {
|
*/ function verify_usergroup() {
|
$user = &$this->data;
| |
return true; } /**
| return true; } /**
|
Zeile 235 | Zeile 244 |
---|
function verify_email() { global $mybb;
|
function verify_email() { global $mybb;
|
|
|
$user = &$this->data;
// Check if an email address has actually been entered. if(trim_blank_chrs($user['email']) == '') { $this->set_error('missing_email');
|
$user = &$this->data;
// Check if an email address has actually been entered. if(trim_blank_chrs($user['email']) == '') { $this->set_error('missing_email');
|
return false; }
| return false; }
|
// Check if this is a proper email address. if(!validate_email_format($user['email'])) { $this->set_error('invalid_email_format');
|
// Check if this is a proper email address. if(!validate_email_format($user['email'])) { $this->set_error('invalid_email_format');
|
return false;
| return false;
|
}
// Check banned emails
| }
// Check banned emails
|
Zeile 267 | Zeile 276 |
---|
if(isset($user['uid'])) { $uid = $user['uid'];
|
if(isset($user['uid'])) { $uid = $user['uid'];
|
}
| }
|
if(email_already_in_use($user['email'], $uid)) { $this->set_error('email_already_in_use'); return false; }
|
if(email_already_in_use($user['email'], $uid)) { $this->set_error('email_already_in_use'); return false; }
|
}
| }
|
// If we have an "email2", verify it matches the existing email if(isset($user['email2']) && $user['email'] != $user['email2'])
| // If we have an "email2", verify it matches the existing email if(isset($user['email2']) && $user['email'] != $user['email2'])
|
Zeile 294 | Zeile 303 |
---|
{ $website = &$this->data['website'];
|
{ $website = &$this->data['website'];
|
if(empty($website) || my_strtolower($website) == 'http://' || my_strtolower($website) == 'https://') { $website = ''; return true; }
// Does the website start with http(s)://? if(my_strtolower(substr($website, 0, 4)) != "http")
| if(!empty($website) && !my_validate_url($website))
|
{
|
{
|
// Website does not start with http://, let's see if the user forgot. $website = "http://".$website;
| $website = 'http://'.$website;
|
}
|
}
|
if(!filter_var($website, FILTER_VALIDATE_URL))
| if(!empty($website) && !my_validate_url($website))
|
{ $this->set_error('invalid_website'); return false;
| { $this->set_error('invalid_website'); return false;
|
Zeile 380 | Zeile 381 |
---|
$this->set_error("invalid_birthday"); return false; }
|
$this->set_error("invalid_birthday"); return false; }
|
else if($birthday['year'] == date("Y"))
| elseif($birthday['year'] == date("Y"))
|
{ // Error if birth date is in future if($birthday['month'] > date("m") || ($birthday['month'] == date("m") && $birthday['day'] > date("d")))
| { // Error if birth date is in future if($birthday['month'] > date("m") || ($birthday['month'] == date("m") && $birthday['day'] > date("d")))
|
Zeile 491 | Zeile 492 |
---|
$profile_fields = &$this->data['profile_fields'];
// Loop through profile fields checking if they exist or not and are filled in.
|
$profile_fields = &$this->data['profile_fields'];
// Loop through profile fields checking if they exist or not and are filled in.
|
$userfields = array(); $comma = '';
| |
// Fetch all profile fields first. $pfcache = $cache->read('profilefields');
| // Fetch all profile fields first. $pfcache = $cache->read('profilefields');
|
Zeile 519 | Zeile 518 |
---|
}
$profilefield['type'] = htmlspecialchars_uni($profilefield['type']);
|
}
$profilefield['type'] = htmlspecialchars_uni($profilefield['type']);
|
| $profilefield['name'] = htmlspecialchars_uni($profilefield['name']);
|
$thing = explode("\n", $profilefield['type'], "2"); $type = trim($thing[0]); $field = "fid{$profilefield['fid']}";
| $thing = explode("\n", $profilefield['type'], "2"); $type = trim($thing[0]); $field = "fid{$profilefield['fid']}";
|
Zeile 577 | Zeile 577 |
---|
$this->set_error('max_limit_reached', array($profilefield['name'], $profilefield['maxlength'])); }
|
$this->set_error('max_limit_reached', array($profilefield['name'], $profilefield['maxlength'])); }
|
if(!empty($profilefield['regex']) && !preg_match("#".$profilefield['regex']."#i", $profile_fields[$field]))
| if(!empty($profilefield['regex']) && !empty($profile_fields[$field]) && !preg_match("#".$profilefield['regex']."#i", $profile_fields[$field]))
|
{ $this->set_error('bad_profile_field_value', array($profilefield['name'])); }
| { $this->set_error('bad_profile_field_value', array($profilefield['name'])); }
|
Zeile 669 | Zeile 669 |
---|
if($options['subscriptionmethod'] < 0 || $options['subscriptionmethod'] > 3) { $options['subscriptionmethod'] = 0;
|
if($options['subscriptionmethod'] < 0 || $options['subscriptionmethod'] > 3) { $options['subscriptionmethod'] = 0;
|
} }
| } }
|
if(array_key_exists('dstcorrection', $options)) { // Value out of range $options['dstcorrection'] = (int)$options['dstcorrection']; if($options['dstcorrection'] < 0 || $options['dstcorrection'] > 2)
|
if(array_key_exists('dstcorrection', $options)) { // Value out of range $options['dstcorrection'] = (int)$options['dstcorrection']; if($options['dstcorrection'] < 0 || $options['dstcorrection'] > 2)
|
{
| {
|
$options['dstcorrection'] = 0; }
|
$options['dstcorrection'] = 0; }
|
}
| }
|
if($options['dstcorrection'] == 1)
|
if($options['dstcorrection'] == 1)
|
{
| {
|
$options['dst'] = 1;
|
$options['dst'] = 1;
|
} else if($options['dstcorrection'] == 0) {
| } elseif($options['dstcorrection'] == 0) {
|
$options['dst'] = 0; }
| $options['dst'] = 0; }
|
Zeile 696 | Zeile 696 |
---|
if($mybb->settings['threadusenetstyle']) { $options['threadmode'] = 'threaded';
|
if($mybb->settings['threadusenetstyle']) { $options['threadmode'] = 'threaded';
|
}
| }
|
else
|
else
|
{
| {
|
$options['threadmode'] = 'linear'; } }
| $options['threadmode'] = 'linear'; } }
|
Zeile 707 | Zeile 707 |
---|
if($this->method == "insert" || (array_key_exists('tpp', $options) && $mybb->settings['usertppoptions'])) { if(!isset($options['tpp']))
|
if($this->method == "insert" || (array_key_exists('tpp', $options) && $mybb->settings['usertppoptions'])) { if(!isset($options['tpp']))
|
{
| {
|
$options['tpp'] = 0; } $explodedtpp = explode(",", $mybb->settings['usertppoptions']);
| $options['tpp'] = 0; } $explodedtpp = explode(",", $mybb->settings['usertppoptions']);
|
Zeile 719 | Zeile 719 |
---|
if($options['tpp'] > $biggest) { $options['tpp'] = $biggest;
|
if($options['tpp'] > $biggest) { $options['tpp'] = $biggest;
|
} }
| } }
|
$options['tpp'] = (int)$options['tpp']; } // Verify the "posts per page" option. if($this->method == "insert" || (array_key_exists('ppp', $options) && $mybb->settings['userpppoptions'])) { if(!isset($options['ppp']))
|
$options['tpp'] = (int)$options['tpp']; } // Verify the "posts per page" option. if($this->method == "insert" || (array_key_exists('ppp', $options) && $mybb->settings['userpppoptions'])) { if(!isset($options['ppp']))
|
{
| {
|
$options['ppp'] = 0; } $explodedppp = explode(",", $mybb->settings['userpppoptions']);
| $options['ppp'] = 0; } $explodedppp = explode(",", $mybb->settings['userpppoptions']);
|
Zeile 745 | Zeile 745 |
---|
} // Is our selected "days prune" option valid or not? if($this->method == "insert" || array_key_exists('daysprune', $options))
|
} // Is our selected "days prune" option valid or not? if($this->method == "insert" || array_key_exists('daysprune', $options))
|
{
| {
|
if(!isset($options['daysprune']))
|
if(!isset($options['daysprune']))
|
{ $options['daysprune'] = 0;
| { $options['daysprune'] = 0;
|
} $options['daysprune'] = (int)$options['daysprune']; if($options['daysprune'] < 0)
| } $options['daysprune'] = (int)$options['daysprune']; if($options['daysprune'] < 0)
|
Zeile 769 | Zeile 769 |
---|
$regdate = &$this->data['regdate'];
$regdate = (int)$regdate;
|
$regdate = &$this->data['regdate'];
$regdate = (int)$regdate;
|
// If the timestamp is below 0, set it to the current time.
| // If the timestamp is below 0, set it to the current time.
|
if($regdate <= 0)
|
if($regdate <= 0)
|
{
| {
|
$regdate = TIME_NOW;
|
$regdate = TIME_NOW;
|
} return true;
| } return true;
|
}
/**
| }
/**
|
Zeile 785 | Zeile 785 |
---|
function verify_lastvisit() { $lastvisit = &$this->data['lastvisit'];
|
function verify_lastvisit() { $lastvisit = &$this->data['lastvisit'];
|
|
|
$lastvisit = (int)$lastvisit; // If the timestamp is below 0, set it to the current time. if($lastvisit <= 0) { $lastvisit = TIME_NOW;
|
$lastvisit = (int)$lastvisit; // If the timestamp is below 0, set it to the current time. if($lastvisit <= 0) { $lastvisit = TIME_NOW;
|
} return true;
}
| } return true;
}
|
/** * Verifies if a last active date is valid or not.
| /** * Verifies if a last active date is valid or not.
|
Zeile 812 | Zeile 812 |
---|
$lastactive = TIME_NOW; } return true;
|
$lastactive = TIME_NOW; } return true;
|
|
|
}
/** * Verifies if an away mode status is valid or not.
|
}
/** * Verifies if an away mode status is valid or not.
|
* * @return boolean True when valid, false when invalid.
| * * @return boolean True when valid, false when invalid.
|
*/ function verify_away() {
| */ function verify_away() {
|
Zeile 834 | Zeile 834 |
---|
$user['away']['awayreason'] = ''; return true; }
|
$user['away']['awayreason'] = ''; return true; }
|
else if($user['away']['returndate'])
| elseif($user['away']['returndate'])
|
{
|
{
|
| // Validate the awayreason length, since the db holds 200 chars for this field $reasonlength = my_strlen($user['away']['awayreason']); if($reasonlength > 200) { $this->set_error("away_too_long", array($reasonlength - 200)); return false; }
|
list($returnday, $returnmonth, $returnyear) = explode('-', $user['away']['returndate']); if(!$returnday || !$returnmonth || !$returnyear) {
| list($returnday, $returnmonth, $returnyear) = explode('-', $user['away']['returndate']); if(!$returnday || !$returnmonth || !$returnyear) {
|
Zeile 850 | Zeile 858 |
---|
}
/**
|
}
/**
|
* Verifies if a langage is valid for this user or not.
| * Verifies if a language is valid for this user or not.
|
* * @return boolean True when valid, false when invalid. */
| * * @return boolean True when valid, false when invalid. */
|
Zeile 864 | Zeile 872 |
---|
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 true; }
/** * Verifies if this is coming from a spam bot or not
| return false; } return true; }
/** * Verifies if a style is valid for this user or not. * * @return boolean True when valid, false when invalid. */ function verify_style() { global $lang;
$user = &$this->data;
if($user['style']) { $theme = get_theme($user['style']);
if(empty($theme) || !is_member($theme['allowedgroups'], $user) && $theme['allowedgroups'] != 'all') { $this->set_error('invalid_style'); return false; } }
return true; }
/** * Verifies if this is coming from a spam bot or not
|
* * @return boolean True when valid, false when invalid.
|
* * @return boolean True when valid, false when invalid.
|
*/
| */
|
function verify_checkfields()
|
function verify_checkfields()
|
{ $user = &$this->data;
| { $user = &$this->data;
|
// An invalid language has been specified? if($user['regcheck1'] !== "" || $user['regcheck2'] !== "true")
|
// An invalid language has been specified? if($user['regcheck1'] !== "" || $user['regcheck2'] !== "true")
|
{
| {
|
$this->set_error("invalid_checkfield"); return false; }
|
$this->set_error("invalid_checkfield"); return false; }
|
| return true; }
/** * Verifies if the user timezone is valid. * If the timezone is invalid, the board default is used. * * @return boolean True when timezone was valid, false otherwise */ function verify_timezone() { $user = &$this->data;
$timezones = get_supported_timezones();
if(!array_key_exists($user['timezone'], $timezones)) { $user['timezone'] = $mybb->settings['timezoneoffset']; return false; }
|
return true; }
| return true; }
|
Zeile 911 | Zeile 965 |
---|
{ $this->verify_username(); $this->verify_username_exists();
|
{ $this->verify_username(); $this->verify_username_exists();
|
}
| }
|
else { unset($user['username']);
| else { unset($user['username']);
|
Zeile 922 | Zeile 976 |
---|
$this->verify_usertitle(); } if($this->method == "insert" || array_key_exists('password', $user))
|
$this->verify_usertitle(); } if($this->method == "insert" || array_key_exists('password', $user))
|
{
| {
|
$this->verify_password(); } if($this->method == "insert" || array_key_exists('usergroup', $user))
| $this->verify_password(); } if($this->method == "insert" || array_key_exists('usergroup', $user))
|
Zeile 932 | Zeile 986 |
---|
if($this->method == "insert" || array_key_exists('email', $user)) { $this->verify_email();
|
if($this->method == "insert" || array_key_exists('email', $user)) { $this->verify_email();
|
}
| }
|
if($this->method == "insert" || array_key_exists('website', $user)) { $this->verify_website();
| if($this->method == "insert" || array_key_exists('website', $user)) { $this->verify_website();
|
Zeile 974 | Zeile 1028 |
---|
$this->verify_lastvisit(); } if($this->method == "insert" || array_key_exists('lastactive', $user))
|
$this->verify_lastvisit(); } if($this->method == "insert" || array_key_exists('lastactive', $user))
|
{
| {
|
$this->verify_lastactive();
|
$this->verify_lastactive();
|
}
| }
|
if($this->method == "insert" || array_key_exists('away', $user))
|
if($this->method == "insert" || array_key_exists('away', $user))
|
{
| {
|
$this->verify_away(); } if($this->method == "insert" || array_key_exists('language', $user)) { $this->verify_language();
|
$this->verify_away(); } if($this->method == "insert" || array_key_exists('language', $user)) { $this->verify_language();
|
}
| } if($this->method == "insert" || array_key_exists('timezone', $user)) { $this->verify_timezone(); }
|
if($this->method == "insert" && array_key_exists('regcheck1', $user) && array_key_exists('regcheck2', $user))
|
if($this->method == "insert" && array_key_exists('regcheck1', $user) && array_key_exists('regcheck2', $user))
|
{
| {
|
$this->verify_checkfields(); } if(array_key_exists('birthdayprivacy', $user)) { $this->verify_birthday_privacy();
|
$this->verify_checkfields(); } if(array_key_exists('birthdayprivacy', $user)) { $this->verify_birthday_privacy();
|
}
$plugins->run_hooks("datahandler_user_validate", $this);
| } if($this->method == "insert" || array_key_exists('style', $user)) { $this->verify_style(); } if($this->method == "insert" || array_key_exists('signature', $user)) { $this->verify_signature(); }
$plugins->run_hooks("datahandler_user_validate", $this);
|
// We are done validating, return. $this->set_validated(true); if(count($this->get_errors()) > 0)
|
// We are done validating, return. $this->set_validated(true); if(count($this->get_errors()) > 0)
|
{
| {
|
return false;
|
return false;
|
}
| }
|
else { return true;
| else { return true;
|
Zeile 1010 | Zeile 1076 |
---|
/** * Inserts a user into the database.
|
/** * Inserts a user into the database.
|
| * * @return array
|
*/ function insert_user() {
| */ function insert_user() {
|
Zeile 1027 | Zeile 1095 |
---|
$user = &$this->data;
|
$user = &$this->data;
|
$array = array('postnum', 'threadnum', 'avatar', 'avatartype', 'additionalgroups', 'displaygroup', 'icq', 'aim', 'yahoo', 'skype', 'google', 'bday', 'signature', 'style', 'dateformat', 'timeformat', 'notepad');
| $array = array('postnum', 'threadnum', 'avatar', 'avatartype', 'additionalgroups', 'displaygroup', 'icq', 'yahoo', 'skype', 'google', 'bday', 'signature', 'style', 'dateformat', 'timeformat', 'notepad');
|
foreach($array as $value) { if(!isset($user[$value]))
| foreach($array as $value) { if(!isset($user[$value]))
|
Zeile 1038 | Zeile 1106 |
---|
$this->user_insert_data = array( "username" => $db->escape_string($user['username']),
|
$this->user_insert_data = array( "username" => $db->escape_string($user['username']),
|
"password" => $user['saltedpw'],
| "password" => $user['password'],
|
"salt" => $user['salt'], "loginkey" => $user['loginkey'], "email" => $db->escape_string($user['email']),
| "salt" => $user['salt'], "loginkey" => $user['loginkey'], "email" => $db->escape_string($user['email']),
|
Zeile 1055 | Zeile 1123 |
---|
"lastvisit" => (int)$user['lastvisit'], "website" => $db->escape_string($user['website']), "icq" => (int)$user['icq'],
|
"lastvisit" => (int)$user['lastvisit'], "website" => $db->escape_string($user['website']), "icq" => (int)$user['icq'],
|
"aim" => $db->escape_string($user['aim']),
| |
"yahoo" => $db->escape_string($user['yahoo']), "skype" => $db->escape_string($user['skype']), "google" => $db->escape_string($user['google']),
| "yahoo" => $db->escape_string($user['yahoo']), "skype" => $db->escape_string($user['skype']), "google" => $db->escape_string($user['google']),
|
Zeile 1115 | Zeile 1182 |
---|
{ $this->user_insert_data['dst'] = 1; }
|
{ $this->user_insert_data['dst'] = 1; }
|
else if($user['options']['dstcorrection'] == 0)
| elseif($user['options']['dstcorrection'] == 0)
|
{ $this->user_insert_data['dst'] = 0; }
| { $this->user_insert_data['dst'] = 0; }
|
Zeile 1175 | Zeile 1242 |
---|
/** * Updates a user in the database.
|
/** * Updates a user in the database.
|
| * * @return bool
|
*/ function update_user() {
| */ function update_user() {
|
Zeile 1186 | Zeile 1255 |
---|
die("The user needs to be validated before inserting it into the DB."); } if(count($this->get_errors()) > 0)
|
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."); }
| die("The user is not valid."); }
|
Zeile 1199 | Zeile 1268 |
---|
{ $this->user_update_data['username'] = $db->escape_string($user['username']); }
|
{ $this->user_update_data['username'] = $db->escape_string($user['username']); }
|
if(isset($user['saltedpw']))
| if(isset($user['password'])) { $this->user_update_data['password'] = $user['password']; } if(isset($user['salt']))
|
{
|
{
|
$this->user_update_data['password'] = $user['saltedpw'];
| |
$this->user_update_data['salt'] = $user['salt'];
|
$this->user_update_data['salt'] = $user['salt'];
|
| } if(isset($user['loginkey'])) {
|
$this->user_update_data['loginkey'] = $user['loginkey']; } if(isset($user['email']))
| $this->user_update_data['loginkey'] = $user['loginkey']; } if(isset($user['email']))
|
Zeile 1233 | Zeile 1308 |
---|
if(isset($user['displaygroup'])) { $this->user_update_data['displaygroup'] = (int)$user['displaygroup'];
|
if(isset($user['displaygroup'])) { $this->user_update_data['displaygroup'] = (int)$user['displaygroup'];
|
}
| }
|
if(isset($user['usertitle']))
|
if(isset($user['usertitle']))
|
{
| {
|
$this->user_update_data['usertitle'] = $db->escape_string($user['usertitle']); } if(isset($user['regdate']))
|
$this->user_update_data['usertitle'] = $db->escape_string($user['usertitle']); } if(isset($user['regdate']))
|
{
| {
|
$this->user_update_data['regdate'] = (int)$user['regdate']; } if(isset($user['lastactive'])) { $this->user_update_data['lastactive'] = (int)$user['lastactive'];
|
$this->user_update_data['regdate'] = (int)$user['regdate']; } if(isset($user['lastactive'])) { $this->user_update_data['lastactive'] = (int)$user['lastactive'];
|
}
| }
|
if(isset($user['lastvisit'])) { $this->user_update_data['lastvisit'] = (int)$user['lastvisit'];
| if(isset($user['lastvisit'])) { $this->user_update_data['lastvisit'] = (int)$user['lastvisit'];
|
Zeile 1261 | Zeile 1336 |
---|
if(isset($user['icq'])) { $this->user_update_data['icq'] = (int)$user['icq'];
|
if(isset($user['icq'])) { $this->user_update_data['icq'] = (int)$user['icq'];
|
} if(isset($user['aim'])) { $this->user_update_data['aim'] = $db->escape_string($user['aim']);
| |
} if(isset($user['yahoo'])) { $this->user_update_data['yahoo'] = $db->escape_string($user['yahoo']);
|
} if(isset($user['yahoo'])) { $this->user_update_data['yahoo'] = $db->escape_string($user['yahoo']);
|
}
| }
|
if(isset($user['skype'])) { $this->user_update_data['skype'] = $db->escape_string($user['skype']);
| if(isset($user['skype'])) { $this->user_update_data['skype'] = $db->escape_string($user['skype']);
|
Zeile 1312 | Zeile 1383 |
---|
} if(isset($user['away'])) {
|
} if(isset($user['away'])) {
|
$this->user_update_data['away'] = $user['away']['away'];
| $this->user_update_data['away'] = (int)$user['away']['away'];
|
$this->user_update_data['awaydate'] = $db->escape_string($user['away']['date']); $this->user_update_data['returndate'] = $db->escape_string($user['away']['returndate']); $this->user_update_data['awayreason'] = $db->escape_string($user['away']['awayreason']);
| $this->user_update_data['awaydate'] = $db->escape_string($user['away']['date']); $this->user_update_data['returndate'] = $db->escape_string($user['away']['returndate']); $this->user_update_data['awayreason'] = $db->escape_string($user['away']['awayreason']);
|
Zeile 1343 | Zeile 1414 |
---|
if($old_user['pmnotice'] == "2" && $this->user_update_data['pmnotice'] == 1) { unset($this->user_update_data['pmnotice']);
|
if($old_user['pmnotice'] == "2" && $this->user_update_data['pmnotice'] == 1) { unset($this->user_update_data['pmnotice']);
|
}
| }
|
$plugins->run_hooks("datahandler_user_update", $this);
|
$plugins->run_hooks("datahandler_user_update", $this);
|
|
|
if(count($this->user_update_data) < 1 && empty($user['user_fields'])) { return false;
| if(count($this->user_update_data) < 1 && empty($user['user_fields'])) { return false;
|
Zeile 1367 | Zeile 1438 |
---|
if(isset($user['usergroup']) && (int)$user['usergroup'] == 5) { $cache->update_awaitingactivation();
|
if(isset($user['usergroup']) && (int)$user['usergroup'] == 5) { $cache->update_awaitingactivation();
|
}
| }
|
// Maybe some userfields need to be updated? if(isset($user['user_fields']) && is_array($user['user_fields']))
| // Maybe some userfields need to be updated? if(isset($user['user_fields']) && is_array($user['user_fields']))
|
Zeile 1392 | Zeile 1463 |
---|
$db->insert_query("userfields", $user_fields); } $db->update_query("userfields", $user['user_fields'], "ufid='{$user['uid']}'", false);
|
$db->insert_query("userfields", $user_fields); } $db->update_query("userfields", $user['user_fields'], "ufid='{$user['uid']}'", false);
|
}
| }
|
// Let's make sure the user's name gets changed everywhere in the db if it changed. if(!empty($this->user_update_data['username']) && $this->user_update_data['username'] != $old_user['username'])
| // Let's make sure the user's name gets changed everywhere in the db if it changed. if(!empty($this->user_update_data['username']) && $this->user_update_data['username'] != $old_user['username'])
|
Zeile 1408 | Zeile 1479 |
---|
$db->update_query("threads", $username_update, "uid='{$user['uid']}'"); $db->update_query("threads", $lastposter_update, "lastposteruid='{$user['uid']}'"); $db->update_query("forums", $lastposter_update, "lastposteruid='{$user['uid']}'");
|
$db->update_query("threads", $username_update, "uid='{$user['uid']}'"); $db->update_query("threads", $lastposter_update, "lastposteruid='{$user['uid']}'"); $db->update_query("forums", $lastposter_update, "lastposteruid='{$user['uid']}'");
|
|
|
$stats = $cache->read("stats"); if($stats['lastuid'] == $user['uid']) { // User was latest to register, update stats update_stats(array("numusers" => "+0"));
|
$stats = $cache->read("stats"); if($stats['lastuid'] == $user['uid']) { // User was latest to register, update stats update_stats(array("numusers" => "+0"));
|
} }
| } }
|
return true; }
/** * Provides a method to completely delete a user. *
|
return true; }
/** * Provides a method to completely delete a user. *
|
* @param array Array of user information * @param integer Whether if delete threads/posts or not * @return boolean True when successful, false if fails
| * @param array $delete_uids Array of user information * @param integer $prunecontent Whether if delete threads/posts or not * @return array
|
*/ function delete_user($delete_uids, $prunecontent=0) {
| */ function delete_user($delete_uids, $prunecontent=0) {
|
Zeile 1451 | Zeile 1522 |
---|
$plugins->run_hooks('datahandler_user_delete_start', $this);
$this->delete_uids = implode(',', $this->delete_uids);
|
$plugins->run_hooks('datahandler_user_delete_start', $this);
$this->delete_uids = implode(',', $this->delete_uids);
|
| if(empty($this->delete_uids)) { $this->deleted_users = 0; $this->return_values = array( "deleted_users" => $this->deleted_users );
return $this->return_values; }
|
$this->delete_content();
// Delete the user
| $this->delete_content();
// Delete the user
|
Zeile 1460 | Zeile 1541 |
---|
// Are we removing the posts/threads of a user? if((int)$prunecontent == 1)
|
// Are we removing the posts/threads of a user? if((int)$prunecontent == 1)
|
{
| {
|
$this->delete_posts();
|
$this->delete_posts();
|
}
| $db->delete_query('announcements', "uid IN({$this->delete_uids})"); }
|
else { // We're just updating the UID
|
else { // We're just updating the UID
|
| $db->update_query('pollvotes', array('uid' => 0), "uid IN({$this->delete_uids})");
|
$db->update_query('posts', array('uid' => 0), "uid IN({$this->delete_uids})"); $db->update_query('threads', array('uid' => 0), "uid IN({$this->delete_uids})");
|
$db->update_query('posts', array('uid' => 0), "uid IN({$this->delete_uids})"); $db->update_query('threads', array('uid' => 0), "uid IN({$this->delete_uids})");
|
| $db->update_query('attachments', array('uid' => 0), "uid IN({$this->delete_uids})"); $db->update_query('announcements', array('uid' => 0), "uid IN({$this->delete_uids})");
|
}
|
}
|
| $db->update_query('privatemessages', array('fromid' => 0), "fromid IN({$this->delete_uids})"); $db->update_query('users', array('referrer' => 0), "referrer IN({$this->delete_uids})");
|
// Update thread ratings $query = $db->query("
| // Update thread ratings $query = $db->query("
|
Zeile 1491 | Zeile 1579 |
---|
// Update forums & threads if user is the lastposter $db->update_query('forums', array('lastposteruid' => 0), "lastposteruid IN({$this->delete_uids})"); $db->update_query('threads', array('lastposteruid' => 0), "lastposteruid IN({$this->delete_uids})");
|
// Update forums & threads if user is the lastposter $db->update_query('forums', array('lastposteruid' => 0), "lastposteruid IN({$this->delete_uids})"); $db->update_query('threads', array('lastposteruid' => 0), "lastposteruid IN({$this->delete_uids})");
|
$cache->update_banned(); $cache->update_moderators();
| |
// Update forum stats update_stats(array('numusers' => '-'.$this->deleted_users));
| // Update forum stats update_stats(array('numusers' => '-'.$this->deleted_users));
|
Zeile 1501 | Zeile 1586 |
---|
$this->return_values = array( "deleted_users" => $this->deleted_users );
|
$this->return_values = array( "deleted_users" => $this->deleted_users );
|
// Update reports cache
| $plugins->run_hooks("datahandler_user_delete_end", $this);
// Update cache $cache->update_banned(); $cache->update_moderators(); $cache->update_forumsdisplay();
|
$cache->update_reportedcontent();
|
$cache->update_reportedcontent();
|
| |
$cache->update_awaitingactivation();
|
$cache->update_awaitingactivation();
|
$plugins->run_hooks("datahandler_user_delete_end", $this);
| $cache->update_birthdays();
|
return $this->return_values;
|
return $this->return_values;
|
}
/** * Provides a method to delete users' content * * @param array Array of user ids, false if they're already set (eg when using the delete_user function) */
| }
/** * Provides a method to delete users' content * * @param array|bool $delete_uids Array of user ids, false if they're already set (eg when using the delete_user function) */
|
function delete_content($delete_uids=false) {
|
function delete_content($delete_uids=false) {
|
global $db, $plugins;
| global $db, $plugins, $mybb;
|
if($delete_uids != false)
|
if($delete_uids != false)
|
{
| {
|
$this->delete_uids = array_map('intval', (array)$delete_uids);
|
$this->delete_uids = array_map('intval', (array)$delete_uids);
|
|
|
foreach($this->delete_uids as $key => $uid) { if(!$uid || is_super_admin($uid) || $uid == $mybb->user['uid'])
| foreach($this->delete_uids as $key => $uid) { if(!$uid || is_super_admin($uid) || $uid == $mybb->user['uid'])
|
Zeile 1533 | Zeile 1621 |
---|
unset($this->delete_uids[$key]); } }
|
unset($this->delete_uids[$key]); } }
|
|
|
$this->delete_uids = implode(',', $this->delete_uids);
|
$this->delete_uids = implode(',', $this->delete_uids);
|
}
| }
|
$plugins->run_hooks('datahandler_user_delete_content', $this);
|
$plugins->run_hooks('datahandler_user_delete_content', $this);
|
| if(empty($this->delete_uids)) { return; }
|
$db->delete_query('userfields', "ufid IN({$this->delete_uids})"); $db->delete_query('privatemessages', "uid IN({$this->delete_uids})");
| $db->delete_query('userfields', "ufid IN({$this->delete_uids})"); $db->delete_query('privatemessages', "uid IN({$this->delete_uids})");
|
Zeile 1569 | Zeile 1662 |
---|
$db->update_query('reportedcontent', array('uid' => 0), "uid IN({$this->delete_uids})");
// Remove any of the user(s) uploaded avatars
|
$db->update_query('reportedcontent', array('uid' => 0), "uid IN({$this->delete_uids})");
// Remove any of the user(s) uploaded avatars
|
$query = $db->simple_select('users', 'avatar', "uid IN({$this->delete_uids}) AND avatartype='upload'"); while($avatar = $db->fetch_field($query, 'avatar'))
| require_once MYBB_ROOT.'inc/functions_upload.php'; foreach(explode(',', $this->delete_uids) as $uid)
|
{
|
{
|
$avatar = substr($avatar, 2, -20); @unlink(MYBB_ROOT.$avatar);
| remove_avatars($uid);
|
}
|
}
|
| |
}
|
}
|
|
|
/** * Provides a method to delete an users posts and threads *
|
/** * Provides a method to delete an users posts and threads *
|
* @param array Array of user ids, false if they're already set (eg when using the delete_user function)
| * @param array|bool $delete_uids Array of user ids, false if they're already set (eg when using the delete_user function)
|
*/ function delete_posts($delete_uids=false)
|
*/ function delete_posts($delete_uids=false)
|
{ global $db, $plugins;
if($delete_uids != false) { $this->delete_uids = array_map('intval', (array)$delete_uids);
foreach($this->delete_uids as $key => $uid)
| { global $db, $plugins, $mybb;
if($delete_uids != false) { $this->delete_uids = array_map('intval', (array)$delete_uids);
foreach($this->delete_uids as $key => $uid)
|
{ if(!$uid || is_super_admin($uid) || $uid == $mybb->user['uid']) {
| { if(!$uid || is_super_admin($uid) || $uid == $mybb->user['uid']) {
|
Zeile 1601 | Zeile 1692 |
---|
}
$this->delete_uids = implode(',', $this->delete_uids);
|
}
$this->delete_uids = implode(',', $this->delete_uids);
|
}
| }
|
require_once MYBB_ROOT.'inc/class_moderation.php'; $moderation = new Moderation();
|
require_once MYBB_ROOT.'inc/class_moderation.php'; $moderation = new Moderation();
|
|
|
$plugins->run_hooks('datahandler_user_delete_posts', $this);
|
$plugins->run_hooks('datahandler_user_delete_posts', $this);
|
| if(empty($this->delete_uids)) { return; }
|
// Threads $query = $db->simple_select('threads', 'tid', "uid IN({$this->delete_uids})"); while($tid = $db->fetch_field($query, 'tid')) { $moderation->delete_thread($tid);
|
// Threads $query = $db->simple_select('threads', 'tid', "uid IN({$this->delete_uids})"); while($tid = $db->fetch_field($query, 'tid')) { $moderation->delete_thread($tid);
|
}
| }
|
// Posts
|
// Posts
|
$pids = array();
| |
$query = $db->simple_select('posts', 'pid', "uid IN({$this->delete_uids})"); while($pid = $db->fetch_field($query, 'pid')) { $moderation->delete_post($pid);
|
$query = $db->simple_select('posts', 'pid', "uid IN({$this->delete_uids})"); while($pid = $db->fetch_field($query, 'pid')) { $moderation->delete_post($pid);
|
$pids[] = (int)$pid; }
// Delete Reports made to users's posts/threads if(!empty($pids)) { $db->delete_query('reportedcontent', "type='posts' AND id IN(".implode(',', $pids).")");
| |
} }
|
} }
|
|
|
/** * Provides a method to clear an users profile *
|
/** * Provides a method to clear an users profile *
|
* @param array Array of user ids, false if they're already set (eg when using the delete_user function) * @param int The new usergroup if the users should be moved (additional usergroups are always removed)
| * @param array|bool $delete_uids Array of user ids, false if they're already set (eg when using the delete_user function) * @param int $gid The new usergroup if the users should be moved (additional usergroups are always removed)
|
*/ function clear_profile($delete_uids=false, $gid=0) {
|
*/ function clear_profile($delete_uids=false, $gid=0) {
|
global $db, $plugins;
| global $db, $plugins, $mybb;
|
// delete_uids isn't a nice name, but it's used as the functions above use the same if($delete_uids != false)
|
// delete_uids isn't a nice name, but it's used as the functions above use the same if($delete_uids != false)
|
{
| {
|
$this->delete_uids = array_map('intval', (array)$delete_uids);
foreach($this->delete_uids as $key => $uid)
| $this->delete_uids = array_map('intval', (array)$delete_uids);
foreach($this->delete_uids as $key => $uid)
|
Zeile 1662 | Zeile 1750 |
---|
"website" => "", "birthday" => "", "icq" => "",
|
"website" => "", "birthday" => "", "icq" => "",
|
"aim" => "",
| |
"yahoo" => "", "skype" => "", "google" => "",
| "yahoo" => "", "skype" => "", "google" => "",
|
Zeile 1685 | Zeile 1772 |
---|
}
$plugins->run_hooks('datahandler_user_clear_profile', $this);
|
}
$plugins->run_hooks('datahandler_user_clear_profile', $this);
|
| if(empty($this->delete_uids)) { return; }
|
$db->update_query("users", $update, "uid IN({$this->delete_uids})"); $db->delete_query('userfields', "ufid IN({$this->delete_uids})");
|
$db->update_query("users", $update, "uid IN({$this->delete_uids})"); $db->delete_query('userfields', "ufid IN({$this->delete_uids})");
|
| // Remove any of the user(s) uploaded avatars require_once MYBB_ROOT.'inc/functions_upload.php'; foreach(explode(',', $this->delete_uids) as $uid) { remove_avatars($uid); } }
public function verify_signature() { global $mybb, $parser;
if(!isset($parser)) { require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser; }
$parser_options = array( 'allow_html' => $mybb->settings['sightml'], 'filter_badwords' => 1, 'allow_mycode' => $mybb->settings['sigmycode'], 'allow_smilies' => $mybb->settings['sigsmilies'], 'allow_imgcode' => $mybb->settings['sigimgcode'], "filter_badwords" => 1 );
$parsed_sig = $parser->parse_message($this->data['signature'], $parser_options);
if((($mybb->settings['sigimgcode'] == 0 && $mybb->settings['sigsmilies'] != 1) && substr_count($parsed_sig, "<img") > 0) || (($mybb->settings['sigimgcode'] == 1 || $mybb->settings['sigsmilies'] == 1) && substr_count($parsed_sig, "<img") > $mybb->settings['maxsigimages']) ) { $imgsallowed = 0;
if($mybb->settings['sigimgcode'] == 1) { $imgsallowed = $mybb->settings['maxsigimages']; }
$this->set_error('too_many_sig_images2', array($imgsallowed)); }
if($mybb->settings['sigcountmycode'] == 0) { $parsed_sig = $parser->text_parse_message($this->data['signature'], array('signature_parse' => '1')); } else { $parsed_sig = $this->data['signature']; }
$parsed_sig = preg_replace("#\s#", "", $parsed_sig); $sig_length = my_strlen($parsed_sig);
if($sig_length > $mybb->settings['siglength']) { $this->set_error('sig_too_long', array($mybb->settings['siglength']));
if($sig_length - $mybb->settings['siglength'] > 1) { $this->set_error('sig_remove_chars_plural', array($sig_length-$mybb->settings['siglength'])); } else { $this->set_error('sig_remove_chars_singular'); } }
if(count($this->get_errors()) > 0) { return false; } return true;
|
} }
| } }
|