Zeile 1 | Zeile 1 |
---|
<?php /** * MyBB 1.4
|
<?php /** * MyBB 1.4
|
* Copyright � 2008 MyBB Group, All Rights Reserved
| * Copyright © 2008 MyBB Group, All Rights Reserved
|
* * Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* * Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: user.php 4162 2008-08-31 16:44:33Z Tikitiki $
| * $Id: user.php 4384 2009-06-19 11:49:42Z Tomm $
|
*/
// Disallow direct access to this file for security reasons
| */
// Disallow direct access to this file for security reasons
|
Zeile 70 | Zeile 70 |
---|
// Fix bad characters $username = trim($username);
|
// Fix bad characters $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);
| $username = str_replace(array(unicode_chr(160), unicode_chr(173), unicode_chr(0xCA), dec_to_utf8(8238), dec_to_utf8(8237), dec_to_utf8(8203)), array(" ", "-", "", "", "", ""), $username);
|
// Remove multiple spaces from the username $username = preg_replace("#\s{2,}#", " ", $username);
| // Remove multiple spaces from the username $username = preg_replace("#\s{2,}#", " ", $username);
|
Zeile 220 | Zeile 220 |
---|
$user = &$this->data; return true; }
|
$user = &$this->data; return true; }
|
|
|
/** * Verifies if an email address is valid or not. *
| /** * Verifies if an email address is valid or not. *
|
Zeile 253 | Zeile 254 |
---|
} // Check signed up emails
|
} // Check signed up emails
|
if($mybb->settings['allowmultipleemails'] == 0)
| // 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"))
|
{ if(email_already_in_use($user['email'], $user['uid'])) {
| { if(email_already_in_use($user['email'], $user['uid'])) {
|
Zeile 264 | Zeile 266 |
---|
// 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; } }
|
|
|
/** * Verifies if a website is valid or not. * * @return boolean True when valid, false when invalid. */ function verify_website()
|
/** * Verifies if a website is valid or not. * * @return boolean True when valid, false when invalid. */ function verify_website()
|
{ $website = &$this->data['website'];
| { $website = &$this->data['website'];
|
if(empty($website) || my_strtolower($website) == 'http://' || my_strtolower($website) == 'https://') { $website = ''; return true;
|
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") { // Website does not start with http://, let's see if the user forgot. $website = "http://".$website;
|
// 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;
|
}
return true; }
| }
return true; }
|
/** * Verifies if an ICQ number is valid or not.
| /** * Verifies if an ICQ number is valid or not.
|
Zeile 307 | Zeile 309 |
---|
if($icq != '' && !is_numeric($icq)) { $this->set_error("invalid_icq_number");
|
if($icq != '' && !is_numeric($icq)) { $this->set_error("invalid_icq_number");
|
return false;
| return false;
|
} $icq = intval($icq); return true;
| } $icq = intval($icq); return true;
|
Zeile 336 | Zeile 338 |
---|
* @return boolean True when valid, false when invalid. */ function verify_birthday()
|
* @return boolean True when valid, false when invalid. */ function verify_birthday()
|
{
| {
|
global $mybb;
$user = &$this->data;
| global $mybb;
$user = &$this->data;
|
Zeile 345 | Zeile 347 |
---|
if(!is_array($birthday)) { return true;
|
if(!is_array($birthday)) { return true;
|
}
| }
|
// Sanitize any input we have $birthday['day'] = intval($birthday['day']); $birthday['month'] = intval($birthday['month']); $birthday['year'] = intval($birthday['year']);
|
// Sanitize any input we have $birthday['day'] = intval($birthday['day']); $birthday['month'] = intval($birthday['month']); $birthday['year'] = intval($birthday['year']);
|
|
|
// Error if a day and month exists, and the birthday day and range is not in range
|
// Error if a day and month exists, and the birthday day and range is not in range
|
if($birthday['day'] && $birthday['month']) { if($birthday['day'] < 1 || $birthday['day'] > 31 || $birthday['month'] < 1 || $birthday['month'] > 12 || ($birthday['month'] == 2 && $birthday['day'] > 29)) { $this->set_error("invalid_birthday"); return false; }
| if($birthday['day'] < 1 || $birthday['day'] > 31 || $birthday['month'] < 1 || $birthday['month'] > 12 || ($birthday['month'] == 2 && $birthday['day'] > 29)) { $this->set_error("invalid_birthday"); return false; }
|
|
|
// Check if the day actually exists. $months = get_bdays($birthday['year']); if($birthday['day'] > $months[$birthday['month']-1]) { $this->set_error("invalid_birthday"); return false; }
| // Check if the day actually exists. $months = get_bdays($birthday['year']); if($birthday['day'] > $months[$birthday['month']-1]) { $this->set_error("invalid_birthday"); return false;
|
}
// Error if a year exists and the year is out of range
| }
// Error if a year exists and the year is out of range
|
Zeile 687 | Zeile 686 |
---|
if($lastactive <= 0) { $lastactive = TIME_NOW;
|
if($lastactive <= 0) { $lastactive = TIME_NOW;
|
} return true;
}
| } return true;
}
|
/** * Verifies if an away mode status is valid or not.
| /** * Verifies if an away mode status is valid or not.
|
Zeile 717 | Zeile 716 |
---|
if(!$returnday || !$returnmonth || !$returnyear) { $this->set_error("missing_returndate");
|
if(!$returnday || !$returnmonth || !$returnyear) { $this->set_error("missing_returndate");
|
} } }
| } } }
|
/** * Verifies if a langage is valid for this user or not.
| /** * Verifies if a langage is valid for this user or not.
|
Zeile 729 | Zeile 728 |
---|
function verify_language() { global $lang;
|
function verify_language() { global $lang;
|
|
|
$language = &$this->data['language'];
// An invalid language has been specified? if($language != '' && !$lang->language_exists($language))
|
$language = &$this->data['language'];
// An invalid language has been specified? if($language != '' && !$lang->language_exists($language))
|
{
| {
|
$this->set_error("invalid_language"); return false; }
| $this->set_error("invalid_language"); return false; }
|
Zeile 747 | Zeile 746 |
---|
* @return boolean True when valid, false when invalid. */ function verify_checkfields()
|
* @return boolean True when valid, false when invalid. */ 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")
|
Zeile 777 | Zeile 776 |
---|
}
if($this->method == "insert" || array_key_exists('username', $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']);
|
Zeile 792 | Zeile 791 |
---|
if($this->method == "insert" || array_key_exists('usertitle', $user)) { $this->verify_usertitle();
|
if($this->method == "insert" || array_key_exists('usertitle', $user)) { $this->verify_usertitle();
|
}
| }
|
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))
|
Zeile 806 | Zeile 805 |
---|
$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 826 | Zeile 825 |
---|
$this->verify_profile_fields(); } if($this->method == "insert" || array_key_exists('referrer', $user))
|
$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)) { $this->verify_options();
|
$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_regdate();
| if($this->method == "insert" || array_key_exists('regdate', $user)) { $this->verify_regdate();
|
Zeile 852 | Zeile 851 |
---|
if($this->method == "insert" || array_key_exists('language', $user)) { $this->verify_language();
|
if($this->method == "insert" || array_key_exists('language', $user)) { $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(); }
|
$plugins->run_hooks_by_ref("datahandler_user_validate", $this);
| if(method_exists($plugins, "run_hooks_by_ref")) { $plugins->run_hooks_by_ref("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 966 | Zeile 968 |
---|
{ $this->user_insert_data['dst'] = 0; }
|
{ $this->user_insert_data['dst'] = 0; }
|
$plugins->run_hooks_by_ref("datahandler_user_insert", $this);
| if(method_exists($plugins, "run_hooks_by_ref")) { $plugins->run_hooks_by_ref("datahandler_user_insert", $this); }
|
$this->uid = $db->insert_query("users", $this->user_insert_data);
$user['user_fields']['ufid'] = $this->uid;
| $this->uid = $db->insert_query("users", $this->user_insert_data);
$user['user_fields']['ufid'] = $this->uid;
|
Zeile 983 | Zeile 988 |
---|
$user['user_fields']["fid{$profile_field['fid']}"] = ''; }
|
$user['user_fields']["fid{$profile_field['fid']}"] = ''; }
|
$db->insert_query("userfields", $user['user_fields']);
| $db->insert_query("userfields", $user['user_fields'], false);
|
// Update forum stats update_stats(array('numusers' => '+1'));
| // Update forum stats update_stats(array('numusers' => '+1'));
|
Zeile 1101 | Zeile 1106 |
---|
} if(isset($user['birthdayprivacy'])) {
|
} if(isset($user['birthdayprivacy'])) {
|
$this->user_update_data['birthdayprivacy'] = $user['birthdayprivacy'];
| $this->user_update_data['birthdayprivacy'] = $db->escape_string($user['birthdayprivacy']);
|
} if(isset($user['style'])) {
| } if(isset($user['style'])) {
|
Zeile 1157 | Zeile 1162 |
---|
{ unset($this->user_update_data['pmnotice']); }
|
{ unset($this->user_update_data['pmnotice']); }
|
$plugins->run_hooks_by_ref("datahandler_user_update", $this);
| if(method_exists($plugins, "run_hooks_by_ref")) { $plugins->run_hooks_by_ref("datahandler_user_update", $this); }
|
if(count($this->user_update_data) < 1) {
| if(count($this->user_update_data) < 1) {
|
Zeile 1196 | Zeile 1204 |
---|
} $db->insert_query("userfields", $user_fields); }
|
} $db->insert_query("userfields", $user_fields); }
|
$db->update_query("userfields", $user['user_fields'], "ufid='{$user['uid']}'");
| $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.
| }
// Let's make sure the user's name gets changed everywhere in the db if it changed.
|