Zeile 211 | Zeile 211 |
---|
$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
|
// Generate our salt $user['salt'] = generate_salt();
// Combine the password and salt
|
$user['saltedpw'] = salt_password($user['md5password'], $user['salt']);
| $user['saltedpw'] = create_password_hash($user['password'], $user['salt'], $user);
|
// Generate the user login key $user['loginkey'] = generate_loginkey();
|
// Generate the user login key $user['loginkey'] = generate_loginkey();
|
return true; }
| return true; }
|
/** * Verifies usergroup selections and other group details.
|
/** * Verifies usergroup selections and other group details.
|
*
| *
|
* @return boolean True when valid, false when invalid. */ function verify_usergroup()
| * @return boolean True when valid, false when invalid. */ function verify_usergroup()
|
Zeile 238 | Zeile 235 |
---|
} /** * Verifies if an email address is valid or not.
|
} /** * Verifies if an email address is valid or not.
|
* * @return boolean True when valid, false when invalid.
| * * @return boolean True when valid, false when invalid.
|
*/ function verify_email() { global $mybb;
$user = &$this->data;
|
*/ function verify_email() { global $mybb;
$user = &$this->data;
|
|
|
// Check if an email address has actually been entered. if(trim_blank_chrs($user['email']) == '')
|
// Check if an email address has actually been entered. if(trim_blank_chrs($user['email']) == '')
|
{
| {
|
$this->set_error('missing_email');
|
$this->set_error('missing_email');
|
return false; }
| return false; }
|
// Check if this is a proper email address. if(!validate_email_format($user['email']))
| // Check if this is a proper email address. if(!validate_email_format($user['email']))
|
Zeile 262 | Zeile 259 |
---|
}
// Check banned emails
|
}
// Check banned emails
|
if(is_banned_email($user['email'], true)) {
| if(is_banned_email($user['email'], true)) {
|
$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)
| // Check signed up emails // Ignore the ACP because the Merge System sometimes produces users with duplicate email addresses (Not A Bug)
|
Zeile 286 | Zeile 283 |
---|
// 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'])
|
{
| {
|
$this->set_error("emails_dont_match"); return false;
|
$this->set_error("emails_dont_match"); return false;
|
}
| }
|
return true; }
| return true; }
|
Zeile 303 | Zeile 300 |
---|
{ $website = &$this->data['website'];
|
{ $website = &$this->data['website'];
|
if(empty($website) || my_strtolower($website) == 'http://' || my_strtolower($website) == 'https://')
| if(!empty($website) && !my_validate_url($website))
|
{
|
{
|
$website = ''; return true; }
// Does the website start with http(s)://? if(my_strtolower(substr($website, 0, 4)) != "http") { // 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');
|
{ $this->set_error('invalid_website');
|
return false; }
| return false; }
|
return true; }
| return true; }
|
Zeile 416 | Zeile 405 |
---|
{ // If the year is specified, put together a d-m-y string $user['bday'] = $birthday['day']."-".$birthday['month']."-".$birthday['year'];
|
{ // 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
| elseif($birthday['day'] && $birthday['month']) { // If only a day and month are specified, put together a d-m string
|
Zeile 921 | Zeile 910 |
---|
}
/**
|
}
/**
|
* Verifies if the user timezone is valid.
| * 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
| * If the timezone is invalid, the board default is used. * * @return boolean True when timezone was valid, false otherwise
|
Zeile 1000 | Zeile 989 |
---|
$this->verify_birthday(); } if($this->method == "insert" || array_key_exists('postnum', $user))
|
$this->verify_birthday(); } if($this->method == "insert" || array_key_exists('postnum', $user))
|
{
| {
|
$this->verify_postnum(); } if($this->method == "insert" || array_key_exists('threadnum', $user))
| $this->verify_postnum(); } if($this->method == "insert" || array_key_exists('threadnum', $user))
|
Zeile 1054 | Zeile 1043 |
---|
if($this->method == "insert" || array_key_exists('style', $user)) { $this->verify_style();
|
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);
| }
$plugins->run_hooks("datahandler_user_validate", $this);
|
Zeile 1098 | Zeile 1091 |
---|
{ $user[$value] = ''; }
|
{ $user[$value] = ''; }
|
}
| }
|
$this->user_insert_data = array( "username" => $db->escape_string($user['username']),
| $this->user_insert_data = array( "username" => $db->escape_string($user['username']),
|
Zeile 1195 | Zeile 1188 |
---|
if(is_array($pfcache)) { foreach($pfcache as $profile_field)
|
if(is_array($pfcache)) { foreach($pfcache as $profile_field)
|
{
| {
|
if(array_key_exists("fid{$profile_field['fid']}", $user['user_fields'])) { continue;
| if(array_key_exists("fid{$profile_field['fid']}", $user['user_fields'])) { continue;
|
Zeile 1317 | Zeile 1310 |
---|
$this->user_update_data['lastvisit'] = (int)$user['lastvisit']; } if(isset($user['signature']))
|
$this->user_update_data['lastvisit'] = (int)$user['lastvisit']; } if(isset($user['signature']))
|
{
| {
|
$this->user_update_data['signature'] = $db->escape_string($user['signature']); } if(isset($user['website'])) { $this->user_update_data['website'] = $db->escape_string($user['website']);
|
$this->user_update_data['signature'] = $db->escape_string($user['signature']); } if(isset($user['website'])) { $this->user_update_data['website'] = $db->escape_string($user['website']);
|
}
| }
|
if(isset($user['icq'])) { $this->user_update_data['icq'] = (int)$user['icq']; } if(isset($user['aim']))
|
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']);
|
$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['skype'])) { $this->user_update_data['skype'] = $db->escape_string($user['skype']); } if(isset($user['google']))
|
if(isset($user['skype'])) { $this->user_update_data['skype'] = $db->escape_string($user['skype']); } if(isset($user['google']))
|
{
| {
|
$this->user_update_data['google'] = $db->escape_string($user['google']); } if(isset($user['bday'])) { $this->user_update_data['birthday'] = $user['bday'];
|
$this->user_update_data['google'] = $db->escape_string($user['google']); } if(isset($user['bday'])) { $this->user_update_data['birthday'] = $user['bday'];
|
}
| }
|
if(isset($user['birthdayprivacy'])) { $this->user_update_data['birthdayprivacy'] = $db->escape_string($user['birthdayprivacy']); } if(isset($user['style']))
|
if(isset($user['birthdayprivacy'])) { $this->user_update_data['birthdayprivacy'] = $db->escape_string($user['birthdayprivacy']); } if(isset($user['style']))
|
{
| {
|
$this->user_update_data['style'] = (int)$user['style']; } if(isset($user['timezone'])) { $this->user_update_data['timezone'] = $db->escape_string($user['timezone']);
|
$this->user_update_data['style'] = (int)$user['style']; } if(isset($user['timezone'])) { $this->user_update_data['timezone'] = $db->escape_string($user['timezone']);
|
}
| }
|
if(isset($user['dateformat'])) { $this->user_update_data['dateformat'] = $db->escape_string($user['dateformat']); } if(isset($user['timeformat']))
|
if(isset($user['dateformat'])) { $this->user_update_data['dateformat'] = $db->escape_string($user['dateformat']); } if(isset($user['timeformat']))
|
{
| {
|
$this->user_update_data['timeformat'] = $db->escape_string($user['timeformat']); } if(isset($user['regip'])) { $this->user_update_data['regip'] = $db->escape_string($user['regip']);
|
$this->user_update_data['timeformat'] = $db->escape_string($user['timeformat']); } if(isset($user['regip'])) { $this->user_update_data['regip'] = $db->escape_string($user['regip']);
|
}
| }
|
if(isset($user['language'])) { $this->user_update_data['language'] = $db->escape_string($user['language']); } if(isset($user['away']))
|
if(isset($user['language'])) { $this->user_update_data['language'] = $db->escape_string($user['language']); } 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']); } if(isset($user['notepad']))
|
$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']); } if(isset($user['notepad']))
|
{
| {
|
$this->user_update_data['notepad'] = $db->escape_string($user['notepad']); } if(isset($user['usernotes'])) { $this->user_update_data['usernotes'] = $db->escape_string($user['usernotes']);
|
$this->user_update_data['notepad'] = $db->escape_string($user['notepad']); } if(isset($user['usernotes'])) { $this->user_update_data['usernotes'] = $db->escape_string($user['usernotes']);
|
}
| }
|
if(isset($user['options']) && is_array($user['options'])) { foreach($user['options'] as $option => $value)
| if(isset($user['options']) && is_array($user['options'])) { foreach($user['options'] as $option => $value)
|
Zeile 1606 | Zeile 1599 |
---|
if($delete_uids != false) { $this->delete_uids = array_map('intval', (array)$delete_uids);
|
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'])
| foreach($this->delete_uids as $key => $uid) { if(!$uid || is_super_admin($uid) || $uid == $mybb->user['uid'])
|
Zeile 1615 | Zeile 1608 |
---|
unset($this->delete_uids[$key]); } }
|
unset($this->delete_uids[$key]); } }
|
|
|
$this->delete_uids = implode(',', $this->delete_uids); }
| $this->delete_uids = implode(',', $this->delete_uids); }
|
Zeile 1651 | Zeile 1644 |
---|
// Delete reports made to the profile or reputation of the deleted users (i.e. made by them) $db->delete_query('reportedcontent', "type='reputation' AND id3 IN({$this->delete_uids}) OR type='reputation' AND id2 IN({$this->delete_uids})"); $db->delete_query('reportedcontent', "type='profile' AND id IN({$this->delete_uids})");
|
// Delete reports made to the profile or reputation of the deleted users (i.e. made by them) $db->delete_query('reportedcontent', "type='reputation' AND id3 IN({$this->delete_uids}) OR type='reputation' AND id2 IN({$this->delete_uids})"); $db->delete_query('reportedcontent', "type='profile' AND id IN({$this->delete_uids})");
|
|
|
// Update the reports made by the deleted users by setting the uid to 0 $db->update_query('reportedcontent', array('uid' => 0), "uid IN({$this->delete_uids})");
| // Update the reports made by the deleted users by setting the uid to 0 $db->update_query('reportedcontent', array('uid' => 0), "uid IN({$this->delete_uids})");
|
Zeile 1662 | Zeile 1655 |
---|
remove_avatars($uid); } }
|
remove_avatars($uid); } }
|
|
|
/** * Provides a method to delete an users posts and threads * * @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)
|
/** * Provides a method to delete an users posts and threads * * @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)
|
{ global $db, $plugins, $mybb;
if($delete_uids != false) {
| { global $db, $plugins, $mybb;
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 1684 | Zeile 1677 |
---|
unset($this->delete_uids[$key]); } }
|
unset($this->delete_uids[$key]); } }
|
|
|
$this->delete_uids = implode(',', $this->delete_uids); }
require_once MYBB_ROOT.'inc/class_moderation.php'; $moderation = new Moderation();
|
$this->delete_uids = implode(',', $this->delete_uids); }
require_once MYBB_ROOT.'inc/class_moderation.php'; $moderation = new Moderation();
|
$plugins->run_hooks('datahandler_user_delete_posts', $this);
if(empty($this->delete_uids)) {
| $plugins->run_hooks('datahandler_user_delete_posts', $this);
if(empty($this->delete_uids)) {
|
return; }
| return; }
|
Zeile 1738 | Zeile 1731 |
---|
}
$this->delete_uids = implode(',', $this->delete_uids);
|
}
$this->delete_uids = implode(',', $this->delete_uids);
|
}
| }
|
$update = array( "website" => "",
| $update = array( "website" => "",
|
Zeile 1759 | Zeile 1752 |
---|
"avatar" => "", 'avatardimensions' => '', 'avatartype' => ''
|
"avatar" => "", 'avatardimensions' => '', 'avatartype' => ''
|
);
| );
|
if($gid > 0) { $update["usergroup"] = (int)$gid;
| if($gid > 0) { $update["usergroup"] = (int)$gid;
|
Zeile 1771 | Zeile 1764 |
---|
if(empty($this->delete_uids)) { return;
|
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})");
|
Zeile 1779 | Zeile 1772 |
---|
// Remove any of the user(s) uploaded avatars require_once MYBB_ROOT.'inc/functions_upload.php'; foreach(explode(',', $this->delete_uids) as $uid)
|
// 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); }
|
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']); } 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;
|
} }
| } }
|