Zeile 90 | Zeile 90 |
---|
}
// Check for certain characters in username (<, >, &, commas and slashes)
|
}
// Check for certain characters in username (<, >, &, commas and slashes)
|
if(strpos($username, "<") !== false || strpos($username, ">") !== false || strpos($username, "&") !== false || my_strpos($username, "\\") !== false || strpos($username, ";") !== false || strpos($username, ",") !== false)
| if(strpos($username, "<") !== false || strpos($username, ">") !== false || strpos($username, "&") !== false || my_strpos($username, "\\") !== false || strpos($username, ";") !== false || strpos($username, ",") !== false || utf8_handle_4byte_string($username, false) == false)
|
{ $this->set_error("bad_characters_username"); return false;
| { $this->set_error("bad_characters_username"); return false;
|
Zeile 116 | Zeile 116 |
---|
global $mybb;
$usertitle = &$this->data['usertitle'];
|
global $mybb;
$usertitle = &$this->data['usertitle'];
|
| $usertitle = utf8_handle_4byte_string($usertitle);
|
// Check if the usertitle is of the correct length. if($mybb->settings['customtitlemaxlength'] != 0 && my_strlen($usertitle) > $mybb->settings['customtitlemaxlength'])
| // Check if the usertitle is of the correct length. if($mybb->settings['customtitlemaxlength'] != 0 && my_strlen($usertitle) > $mybb->settings['customtitlemaxlength'])
|
Zeile 126 | Zeile 127 |
---|
return true; }
|
return true; }
|
|
|
/** * Verifies if a username is already in use or not. *
| /** * Verifies if a username is already in use or not. *
|
Zeile 138 | Zeile 139 |
---|
$username = &$this->data['username'];
|
$username = &$this->data['username'];
|
$uid_check = "";
| $uid_check = "";
|
if($this->data['uid']) { $uid_check = " AND uid!='{$this->data['uid']}'";
|
if($this->data['uid']) { $uid_check = " AND uid!='{$this->data['uid']}'";
|
}
| }
|
$query = $db->simple_select("users", "COUNT(uid) AS count", "LOWER(username)='".$db->escape_string(strtolower(trim($username)))."'{$uid_check}");
|
$query = $db->simple_select("users", "COUNT(uid) AS count", "LOWER(username)='".$db->escape_string(strtolower(trim($username)))."'{$uid_check}");
|
|
|
$user_count = $db->fetch_field($query, "count"); if($user_count > 0) {
| $user_count = $db->fetch_field($query, "count"); if($user_count > 0) {
|
Zeile 173 | Zeile 174 |
---|
if(my_strlen($user['password']) < $mybb->settings['minpasswordlength'] || my_strlen($user['password']) > $mybb->settings['maxpasswordlength']) { $this->set_error('invalid_password_length', array($mybb->settings['minpasswordlength'], $mybb->settings['maxpasswordlength']));
|
if(my_strlen($user['password']) < $mybb->settings['minpasswordlength'] || my_strlen($user['password']) > $mybb->settings['maxpasswordlength']) { $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'] == 1)
| // See if the board has "require complex passwords" enabled. if($mybb->settings['requirecomplexpasswords'] == 1)
|
Zeile 183 | Zeile 184 |
---|
// 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'])) {
|
// 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');
| $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'])
|
return false; } }
// If we have a "password2" check if they both match if(isset($user['password2']) && $user['password'] != $user['password2'])
|
{
| {
|
$this->set_error("passwords_dont_match"); return false; }
| $this->set_error("passwords_dont_match"); return false; }
|
Zeile 235 | Zeile 236 |
---|
if(trim_blank_chrs($user['email']) == '') { $this->set_error('missing_email');
|
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 if(is_banned_email($user['email'], true))
| // Check banned emails if(is_banned_email($user['email'], true))
|
Zeile 251 | Zeile 252 |
---|
$this->set_error('banned_email'); return false; }
|
$this->set_error('banned_email'); return false; }
|
|
|
// Check signed up emails // Ignore the ACP because the Merge System sometimes produces users with duplicate email addresses (Not A Bug) if($mybb->settings['allowmultipleemails'] == 0 && !defined("IN_ADMINCP"))
| // Check signed up emails // Ignore the ACP because the Merge System sometimes produces users with duplicate email addresses (Not A Bug) if($mybb->settings['allowmultipleemails'] == 0 && !defined("IN_ADMINCP"))
|
Zeile 282 | Zeile 283 |
---|
{ $website = &$this->data['website'];
|
{ $website = &$this->data['website'];
|
if(empty($website) || my_strtolower($website) == 'http://' || my_strtolower($website) == 'https://')
| if(empty($website) || my_strtolower($website) == 'http://' || my_strtolower($website) == 'https://' || utf8_handle_4byte_string($website, false) == false)
|
{ $website = ''; return true;
| { $website = ''; return true;
|
Zeile 416 | Zeile 417 |
---|
{ // No field is specified, so return an empty string for an unknown birthday $user['bday'] = '';
|
{ // No field is specified, so return an empty string for an unknown birthday $user['bday'] = '';
|
} return true;
| } return true; }
/** * Verifies if the birthday privacy option is valid or not. * * @return boolean True when valid, false when invalid. */ function verify_birthday_privacy() { $birthdayprivacy = &$this->data['birthdayprivacy']; $accepted = array( 'none', 'age', 'all');
if(!in_array($birthdayprivacy, $accepted)) { $this->set_error("invalid_birthday_privacy"); return false; } return true;
|
}
|
}
|
|
|
/** * Verifies if the post count field is filled in correctly. *
| /** * Verifies if the post count field is filled in correctly. *
|
Zeile 428 | Zeile 450 |
---|
function verify_postnum() { $user = &$this->data;
|
function verify_postnum() { $user = &$this->data;
|
|
|
if($user['postnum'] < 0) { $this->set_error("invalid_postnum"); return false;
|
if($user['postnum'] < 0) { $this->set_error("invalid_postnum"); return false;
|
} return true; }
/**
| }
return true; }
/**
|
* Verifies if a profile fields are filled in correctly. * * @return boolean True when valid, false when invalid.
| * Verifies if a profile fields are filled in correctly. * * @return boolean True when valid, false when invalid.
|
Zeile 446 | Zeile 468 |
---|
function verify_profile_fields() { global $db;
|
function verify_profile_fields() { global $db;
|
|
|
$user = &$this->data; $profile_fields = &$this->data['profile_fields'];
| $user = &$this->data; $profile_fields = &$this->data['profile_fields'];
|
Zeile 454 | Zeile 476 |
---|
$userfields = array(); $comma = ''; $editable = '';
|
$userfields = array(); $comma = ''; $editable = '';
|
|
|
if(!$this->data['profile_fields_editable']) { $editable = "editable=1";
| if(!$this->data['profile_fields_editable']) { $editable = "editable=1";
|
Zeile 490 | Zeile 512 |
---|
// Sort out multiselect/checkbox profile fields. $options = ''; if(($type == "multiselect" || $type == "checkbox") && is_array($profile_fields[$field]))
|
// Sort out multiselect/checkbox profile fields. $options = ''; if(($type == "multiselect" || $type == "checkbox") && is_array($profile_fields[$field]))
|
{ $expoptions = explode("\n", $thing[1]); $expoptions = array_map('trim', $expoptions);
| { $expoptions = explode("\n", $thing[1]); $expoptions = array_map('trim', $expoptions);
|
foreach($profile_fields[$field] as $value) { if(!in_array(htmlspecialchars_uni($value), $expoptions))
| foreach($profile_fields[$field] as $value) { if(!in_array(htmlspecialchars_uni($value), $expoptions))
|
Zeile 522 | Zeile 544 |
---|
{ $this->set_error('max_limit_reached', array($profilefield['name'], $profilefield['maxlength'])); }
|
{ $this->set_error('max_limit_reached', array($profilefield['name'], $profilefield['maxlength'])); }
|
| $profile_fields[$field] = utf8_handle_4byte_string($profile_fields[$field]);
|
$options = $db->escape_string($profile_fields[$field]); } else {
|
$options = $db->escape_string($profile_fields[$field]); } else {
|
| $profile_fields[$field] = utf8_handle_4byte_string($profile_fields[$field]);
|
if($profilefield['maxlength'] > 0 && my_strlen($profile_fields[$field]) > $profilefield['maxlength']) { $this->set_error('max_limit_reached', array($profilefield['name'], $profilefield['maxlength']));
| if($profilefield['maxlength'] > 0 && my_strlen($profile_fields[$field]) > $profilefield['maxlength']) { $this->set_error('max_limit_reached', array($profilefield['name'], $profilefield['maxlength']));
|
Zeile 563 | Zeile 588 |
---|
} } $user['referrer_uid'] = $referrer['uid'];
|
} } $user['referrer_uid'] = $referrer['uid'];
|
|
|
return true; }
| return true; }
|
Zeile 575 | Zeile 600 |
---|
function verify_options() { global $mybb;
|
function verify_options() { global $mybb;
|
|
|
$options = &$this->data['options'];
// Verify yes/no options.
| $options = &$this->data['options'];
// Verify yes/no options.
|
Zeile 591 | Zeile 616 |
---|
$this->verify_yesno_option($options, 'showavatars', 1); $this->verify_yesno_option($options, 'showquickreply', 1); $this->verify_yesno_option($options, 'showredirect', 1);
|
$this->verify_yesno_option($options, 'showavatars', 1); $this->verify_yesno_option($options, 'showquickreply', 1); $this->verify_yesno_option($options, 'showredirect', 1);
|
|
|
if($mybb->settings['postlayout'] == 'classic')
|
if($mybb->settings['postlayout'] == 'classic')
|
{
| {
|
$this->verify_yesno_option($options, 'classicpostbit', 1);
|
$this->verify_yesno_option($options, 'classicpostbit', 1);
|
}
| }
|
else { $this->verify_yesno_option($options, 'classicpostbit', 0); }
|
else { $this->verify_yesno_option($options, 'classicpostbit', 0); }
|
|
|
if(array_key_exists('subscriptionmethod', $options))
|
if(array_key_exists('subscriptionmethod', $options))
|
{ // Value out of range
| { // Value out of range
|
$options['subscriptionmethod'] = intval($options['subscriptionmethod']); if($options['subscriptionmethod'] < 0 || $options['subscriptionmethod'] > 2) {
| $options['subscriptionmethod'] = intval($options['subscriptionmethod']); if($options['subscriptionmethod'] < 0 || $options['subscriptionmethod'] > 2) {
|
Zeile 620 | Zeile 645 |
---|
$options['dstcorrection'] = 0; } }
|
$options['dstcorrection'] = 0; } }
|
|
|
if($options['dstcorrection'] == 1) { $options['dst'] = 1;
| if($options['dstcorrection'] == 1) { $options['dst'] = 1;
|
Zeile 642 | Zeile 667 |
---|
{ $options['showcodebuttons'] = 1; }
|
{ $options['showcodebuttons'] = 1; }
|
|
|
if($this->method == "insert" || (isset($options['threadmode']) && $options['threadmode'] != "linear" && $options['threadmode'] != "threaded")) { if($mybb->settings['threadusenetstyle'])
| if($this->method == "insert" || (isset($options['threadmode']) && $options['threadmode'] != "linear" && $options['threadmode'] != "threaded")) { if($mybb->settings['threadusenetstyle'])
|
Zeile 782 | Zeile 807 |
---|
$this->set_error("missing_returndate"); return false; }
|
$this->set_error("missing_returndate"); return false; }
|
|
|
// Validate the return date lengths $user['away']['returndate'] = substr($returnday, 0, 2).'-'.substr($returnmonth, 0, 2).'-'.substr($returnyear, 0, 4); }
| // Validate the return date lengths $user['away']['returndate'] = substr($returnday, 0, 2).'-'.substr($returnmonth, 0, 2).'-'.substr($returnyear, 0, 4); }
|
Zeile 791 | Zeile 816 |
---|
/** * Verifies if a langage is valid for this user or not.
|
/** * Verifies if a langage is valid for this user or not.
|
*
| *
|
* @return boolean True when valid, false when invalid. */ function verify_language() { global $lang;
|
* @return boolean True when valid, false when invalid. */ function verify_language() { global $lang;
|
$language = &$this->data['language'];
// An invalid language has been specified?
| $language = &$this->data['language'];
// An invalid language has been specified?
|
if($language != '' && !$lang->language_exists($language)) { $this->set_error("invalid_language");
| if($language != '' && !$lang->language_exists($language)) { $this->set_error("invalid_language");
|
Zeile 808 | Zeile 833 |
---|
} return true; }
|
} return true; }
|
|
|
/** * Verifies if this is coming from a spam bot or not *
| /** * Verifies if this is coming from a spam bot or not *
|
Zeile 817 | Zeile 842 |
---|
function verify_checkfields() { $user = &$this->data;
|
function verify_checkfields() { $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; }
|
Zeile 855 | Zeile 880 |
---|
else { unset($user['username']);
|
else { unset($user['username']);
|
}
| }
|
} if($this->method == "insert" || array_key_exists('usertitle', $user)) {
| } if($this->method == "insert" || array_key_exists('usertitle', $user)) {
|
Zeile 874 | Zeile 899 |
---|
$this->verify_email(); } if($this->method == "insert" || array_key_exists('website', $user))
|
$this->verify_email(); } if($this->method == "insert" || array_key_exists('website', $user))
|
{
| {
|
$this->verify_website(); } if($this->method == "insert" || array_key_exists('icq', $user))
| $this->verify_website(); } if($this->method == "insert" || array_key_exists('icq', $user))
|
Zeile 892 | Zeile 917 |
---|
if($this->method == "insert" || array_key_exists('postnum', $user)) { $this->verify_postnum();
|
if($this->method == "insert" || array_key_exists('postnum', $user)) { $this->verify_postnum();
|
}
| }
|
if($this->method == "insert" || array_key_exists('profile_fields', $user))
|
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)) { $this->verify_referrer(); } if($this->method == "insert" || array_key_exists('options', $user))
|
if($this->method == "insert" || array_key_exists('referrer', $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 920 | Zeile 945 |
---|
if($this->method == "insert" || array_key_exists('away', $user)) { $this->verify_away();
|
if($this->method == "insert" || array_key_exists('away', $user)) { $this->verify_away();
|
}
| }
|
if($this->method == "insert" || array_key_exists('language', $user))
|
if($this->method == "insert" || array_key_exists('language', $user))
|
{
| {
|
$this->verify_language();
|
$this->verify_language();
|
}
| }
|
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(); }
|
$this->verify_checkfields(); }
|
| if(array_key_exists('birthdayprivacy', $user)) { $this->verify_birthday_privacy(); }
|
$plugins->run_hooks("datahandler_user_validate", $this);
|
$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)
|
Zeile 979 | Zeile 1008 |
---|
"regdate" => intval($user['regdate']), "lastactive" => intval($user['lastactive']), "lastvisit" => intval($user['lastvisit']),
|
"regdate" => intval($user['regdate']), "lastactive" => intval($user['lastactive']), "lastvisit" => intval($user['lastvisit']),
|
"website" => $db->escape_string(htmlspecialchars($user['website'])),
| "website" => $db->escape_string(htmlspecialchars_uni($user['website'])),
|
"icq" => intval($user['icq']),
|
"icq" => intval($user['icq']),
|
"aim" => $db->escape_string(htmlspecialchars($user['aim'])), "yahoo" => $db->escape_string(htmlspecialchars($user['yahoo'])), "msn" => $db->escape_string(htmlspecialchars($user['msn'])),
| "aim" => $db->escape_string(htmlspecialchars_uni($user['aim'])), "yahoo" => $db->escape_string(htmlspecialchars_uni($user['yahoo'])), "msn" => $db->escape_string(htmlspecialchars_uni($user['msn'])),
|
"birthday" => $user['bday'], "signature" => $db->escape_string($user['signature']), "allownotices" => $user['options']['allownotices'],
| "birthday" => $user['bday'], "signature" => $db->escape_string($user['signature']), "allownotices" => $user['options']['allownotices'],
|
Zeile 1031 | Zeile 1060 |
---|
"classicpostbit" => $user['options']['classicpostbit'], "usernotes" => '' );
|
"classicpostbit" => $user['options']['classicpostbit'], "usernotes" => '' );
|
|
|
if($user['options']['dstcorrection'] == 1) { $this->user_insert_data['dst'] = 1; } else if($user['options']['dstcorrection'] == 0)
|
if($user['options']['dstcorrection'] == 1) { $this->user_insert_data['dst'] = 1; } else if($user['options']['dstcorrection'] == 0)
|
{
| {
|
$this->user_insert_data['dst'] = 0;
|
$this->user_insert_data['dst'] = 0;
|
}
| }
|
$plugins->run_hooks("datahandler_user_insert", $this);
|
$plugins->run_hooks("datahandler_user_insert", $this);
|
|
|
$this->uid = $db->insert_query("users", $this->user_insert_data);
|
$this->uid = $db->insert_query("users", $this->user_insert_data);
|
|
|
$user['user_fields']['ufid'] = $this->uid;
|
$user['user_fields']['ufid'] = $this->uid;
|
|
|
$query = $db->simple_select("profilefields", "fid"); while($profile_field = $db->fetch_array($query)) {
| $query = $db->simple_select("profilefields", "fid"); while($profile_field = $db->fetch_array($query)) {
|
Zeile 1058 | Zeile 1087 |
---|
}
$db->insert_query("userfields", $user['user_fields'], false);
|
}
$db->insert_query("userfields", $user['user_fields'], false);
|
|
|
if($this->user_insert_data['referrer'] != 0) { $db->write_query("
| if($this->user_insert_data['referrer'] != 0) { $db->write_query("
|
Zeile 1160 | Zeile 1189 |
---|
} if(isset($user['website'])) {
|
} if(isset($user['website'])) {
|
$this->user_update_data['website'] = $db->escape_string(htmlspecialchars($user['website']));
| $this->user_update_data['website'] = $db->escape_string(htmlspecialchars_uni($user['website']));
|
} if(isset($user['icq'])) {
| } if(isset($user['icq'])) {
|
Zeile 1168 | Zeile 1197 |
---|
} if(isset($user['aim'])) {
|
} if(isset($user['aim'])) {
|
$this->user_update_data['aim'] = $db->escape_string(htmlspecialchars($user['aim']));
| $this->user_update_data['aim'] = $db->escape_string(htmlspecialchars_uni($user['aim']));
|
} if(isset($user['yahoo'])) {
|
} if(isset($user['yahoo'])) {
|
$this->user_update_data['yahoo'] = $db->escape_string(htmlspecialchars($user['yahoo']));
| $this->user_update_data['yahoo'] = $db->escape_string(htmlspecialchars_uni($user['yahoo']));
|
} if(isset($user['msn'])) {
|
} if(isset($user['msn'])) {
|
$this->user_update_data['msn'] = $db->escape_string(htmlspecialchars($user['msn']));
| $this->user_update_data['msn'] = $db->escape_string(htmlspecialchars_uni($user['msn']));
|
} if(isset($user['bday'])) {
| } if(isset($user['bday'])) {
|
Zeile 1244 | Zeile 1273 |
---|
{ unset($this->user_update_data['pmnotice']); }
|
{ 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']))
|
if(count($this->user_update_data) < 1 && empty($user['user_fields']))
|
{ return false; }
| { return false; }
|
if(count($this->user_update_data) > 0) { // Actual updating happens here. $db->update_query("users", $this->user_update_data, "uid='{$user['uid']}'"); }
|
if(count($this->user_update_data) > 0) { // Actual updating happens here. $db->update_query("users", $this->user_update_data, "uid='{$user['uid']}'"); }
|
|
|
$cache->update_moderators(); if(isset($user['bday']) || isset($user['username'])) { $cache->update_birthdays();
|
$cache->update_moderators(); if(isset($user['bday']) || isset($user['username'])) { $cache->update_birthdays();
|
}
| }
|
// 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 1303 | Zeile 1332 |
---|
$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']) {
| $stats = $cache->read("stats"); if($stats['lastuid'] == $user['uid']) {
|