Zeile 314 | Zeile 314 |
---|
return false; }
|
return false; }
|
return true; }
/** * Verifies if an ICQ number is valid or not. * * @return boolean True when valid, false when invalid. */ function verify_icq() { $icq = &$this->data['icq'];
if($icq != '' && !is_numeric($icq)) { $this->set_error("invalid_icq_number"); return false; } $icq = (int)$icq;
| |
return true; }
| return true; }
|
Zeile 343 | Zeile 325 |
---|
function verify_birthday() { global $mybb;
|
function verify_birthday() { global $mybb;
|
|
|
$user = &$this->data; $birthday = &$user['birthday'];
|
$user = &$this->data; $birthday = &$user['birthday'];
|
|
|
if(!is_array($birthday)) { return true;
| if(!is_array($birthday)) { return true;
|
Zeile 413 | Zeile 395 |
---|
{ // If only a day and month are specified, put together a d-m string $user['bday'] = $birthday['day']."-".$birthday['month']."-";
|
{ // If only a day and month are specified, put together a d-m string $user['bday'] = $birthday['day']."-".$birthday['month']."-";
|
}
| }
|
else { // No field is specified, so return an empty string for an unknown birthday
| else { // No field is specified, so return an empty string for an unknown birthday
|
Zeile 436 | Zeile 418 |
---|
'all');
if(!in_array($birthdayprivacy, $accepted))
|
'all');
if(!in_array($birthdayprivacy, $accepted))
|
{
| {
|
$this->set_error("invalid_birthday_privacy"); return false;
|
$this->set_error("invalid_birthday_privacy"); return false;
|
| } else if ($birthdayprivacy == 'age') { $birthdayyear = &$this->data['birthday']['year']; if(empty($birthdayyear)) { $this->set_error("conflicted_birthday_privacy"); return false; }
|
} return true; }
|
} return true; }
|
|
|
/** * Verifies if the post count field is filled in correctly. *
| /** * Verifies if the post count field is filled in correctly. *
|
Zeile 455 | Zeile 446 |
---|
if(isset($user['postnum']) && $user['postnum'] < 0) { $this->set_error("invalid_postnum");
|
if(isset($user['postnum']) && $user['postnum'] < 0) { $this->set_error("invalid_postnum");
|
return false; }
return true;
| return false; }
return true;
|
}
/**
| }
/**
|
Zeile 506 | Zeile 497 |
---|
$profilefield['editableby'] = -1; }
|
$profilefield['editableby'] = -1; }
|
if(!is_member($profilefield['editableby'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups'])))
| if(isset($user['usergroup'])) { $usergroup = $user['usergroup']; } else { $usergroup = ''; } if(isset($user['additionalgroups'])) { $additionalgroups = $user['additionalgroups']; } else { $additionalgroups = ''; }
if(!is_member($profilefield['editableby'], array('usergroup' => $usergroup, 'additionalgroups' => $additionalgroups)))
|
{ continue; }
| { continue; }
|
Zeile 603 | Zeile 611 |
---|
$user = &$this->data;
// Does the referrer exist or not?
|
$user = &$this->data;
// Does the referrer exist or not?
|
if($mybb->settings['usereferrals'] == 1 && $user['referrer'] != '')
| if($mybb->settings['usereferrals'] == 1 && !empty($user['referrer']))
|
{ $referrer = get_user_by_username($user['referrer']);
|
{ $referrer = get_user_by_username($user['referrer']);
|
if(empty($referrer['uid']))
| if(!$referrer)
|
{ $this->set_error('invalid_referrer', array($user['referrer'])); return false;
| { $this->set_error('invalid_referrer', array($user['referrer'])); return false;
|
Zeile 633 | Zeile 641 |
---|
global $mybb;
$options = &$this->data['options'];
|
global $mybb;
$options = &$this->data['options'];
|
| if(!is_array($options)) { $options = array(); }
|
// Verify yes/no options. $this->verify_yesno_option($options, 'allownotices', 1);
| // Verify yes/no options. $this->verify_yesno_option($options, 'allownotices', 1);
|
Zeile 680 | Zeile 693 |
---|
{ $options['dstcorrection'] = 0; }
|
{ $options['dstcorrection'] = 0; }
|
}
| |
|
|
if($options['dstcorrection'] == 1) { $options['dst'] = 1; } elseif($options['dstcorrection'] == 0) { $options['dst'] = 0;
| if($options['dstcorrection'] == 1) { $options['dst'] = 1; } elseif($options['dstcorrection'] == 0) { $options['dst'] = 0; }
|
}
if($this->method == "insert" || (isset($options['threadmode']) && $options['threadmode'] != "linear" && $options['threadmode'] != "threaded" && $options['threadmode'] != ''))
| }
if($this->method == "insert" || (isset($options['threadmode']) && $options['threadmode'] != "linear" && $options['threadmode'] != "threaded" && $options['threadmode'] != ''))
|
Zeile 881 | Zeile 894 |
---|
$user = &$this->data;
|
$user = &$this->data;
|
if($user['style'])
| if(!empty($user['style']))
|
{ $theme = get_theme($user['style']);
| { $theme = get_theme($user['style']);
|
Zeile 889 | Zeile 902 |
---|
{ $this->set_error('invalid_style'); return false;
|
{ $this->set_error('invalid_style'); return false;
|
} }
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 908 | Zeile 921 |
---|
if($user['regcheck1'] !== "" || $user['regcheck2'] !== "true") { $this->set_error("invalid_checkfield");
|
if($user['regcheck1'] !== "" || $user['regcheck2'] !== "true") { $this->set_error("invalid_checkfield");
|
return false; } return true; }
| return false; } return true; }
|
/** * Verifies if the user timezone is valid.
| /** * Verifies if the user timezone is valid.
|
Zeile 926 | Zeile 939 |
---|
$user = &$this->data;
$timezones = get_supported_timezones();
|
$user = &$this->data;
$timezones = get_supported_timezones();
|
if(!array_key_exists($user['timezone'], $timezones))
| if(!isset($user['timezone']) || !array_key_exists($user['timezone'], $timezones))
|
{ $user['timezone'] = $mybb->settings['timezoneoffset']; return false; }
return true;
|
{ $user['timezone'] = $mybb->settings['timezoneoffset']; return false; }
return true;
|
}
| }
|
/** * Validate all user assets. *
| /** * Validate all user assets. *
|
Zeile 981 | Zeile 994 |
---|
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))
|
if($this->method == "insert" || array_key_exists('website', $user))
|
{
| {
|
$this->verify_website();
|
$this->verify_website();
|
} if($this->method == "insert" || array_key_exists('icq', $user)) { $this->verify_icq();
| |
} if($this->method == "insert" || (isset($user['birthday']) && is_array($user['birthday']))) {
| } if($this->method == "insert" || (isset($user['birthday']) && is_array($user['birthday']))) {
|
Zeile 1031 | Zeile 1040 |
---|
$this->verify_away(); } if($this->method == "insert" || array_key_exists('language', $user))
|
$this->verify_away(); } if($this->method == "insert" || array_key_exists('language', $user))
|
{
| {
|
$this->verify_language();
|
$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('timezone', $user)) { $this->verify_timezone(); } 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(); } if($this->method == "insert" || array_key_exists('style', $user))
|
if(array_key_exists('birthdayprivacy', $user)) { $this->verify_birthday_privacy(); } if($this->method == "insert" || array_key_exists('style', $user))
|
{
| {
|
$this->verify_style(); } if($this->method == "insert" || array_key_exists('signature', $user)) { $this->verify_signature();
|
$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)
|
$plugins->run_hooks("datahandler_user_validate", $this);
// We are done validating, return. $this->set_validated(true); if(count($this->get_errors()) > 0)
|
{
| {
|
return false; } else
| return false; } else
|
Zeile 1068 | Zeile 1077 |
---|
return true; } }
|
return true; } }
|
|
|
/** * Inserts a user into the database. *
| /** * Inserts a user into the database. *
|
Zeile 1077 | Zeile 1086 |
---|
function insert_user() { global $db, $cache, $plugins;
|
function insert_user() { global $db, $cache, $plugins;
|
// Yes, validating is required. if(!$this->get_validated())
| // Yes, validating is required. if(!$this->get_validated())
|
{ die("The user needs to be validated before inserting it into the DB.");
|
{ die("The user needs to be validated before inserting it into the DB.");
|
}
| }
|
if(count($this->get_errors()) > 0)
|
if(count($this->get_errors()) > 0)
|
{
| {
|
die("The user is not valid.");
|
die("The user is not valid.");
|
}
$user = &$this->data;
| }
$user = &$this->data;
$array = array('postnum', 'threadnum', 'avatar', 'avatartype', 'additionalgroups', 'displaygroup', 'skype', 'google', 'bday', 'signature', 'style', 'dateformat', 'timeformat', 'notepad', 'regip', 'lastip', 'coppa_user'); foreach($array as $value) { if(!isset($user[$value])) { $user[$value] = ''; } }
|
|
|
$array = array('postnum', 'threadnum', 'avatar', 'avatartype', 'additionalgroups', 'displaygroup', 'icq', 'skype', 'google', 'bday', 'signature', 'style', 'dateformat', 'timeformat', 'notepad');
| $array = array('subscriptionmethod', 'dstcorrection');
|
foreach($array as $value) {
|
foreach($array as $value) {
|
if(!isset($user[$value]))
| if(!isset($user['options'][$value]))
|
{
|
{
|
$user[$value] = '';
| $user['options'][$value] = '';
|
} }
|
} }
|
|
|
// If user is being created from ACP, there is no last visit or last active if(defined('IN_ADMINCP')) {
| // If user is being created from ACP, there is no last visit or last active if(defined('IN_ADMINCP')) {
|
Zeile 1123 | Zeile 1141 |
---|
"lastactive" => (int)$user['lastactive'], "lastvisit" => (int)$user['lastvisit'], "website" => $db->escape_string($user['website']),
|
"lastactive" => (int)$user['lastactive'], "lastvisit" => (int)$user['lastvisit'], "website" => $db->escape_string($user['website']),
|
"icq" => (int)$user['icq'],
| |
"skype" => $db->escape_string($user['skype']), "google" => $db->escape_string($user['google']), "birthday" => $user['bday'],
| "skype" => $db->escape_string($user['skype']), "google" => $db->escape_string($user['google']), "birthday" => $user['bday'],
|
Zeile 1152 | Zeile 1169 |
---|
"dateformat" => $db->escape_string($user['dateformat']), "timeformat" => $db->escape_string($user['timeformat']), "regip" => $db->escape_binary($user['regip']),
|
"dateformat" => $db->escape_string($user['dateformat']), "timeformat" => $db->escape_string($user['timeformat']), "regip" => $db->escape_binary($user['regip']),
|
| "lastip" => $db->escape_binary($user['lastip']),
|
"language" => $db->escape_string($user['language']), "showcodebuttons" => (int)$user['options']['showcodebuttons'], "sourceeditor" => (int)$user['options']['sourceeditor'],
| "language" => $db->escape_string($user['language']), "showcodebuttons" => (int)$user['options']['showcodebuttons'], "sourceeditor" => (int)$user['options']['sourceeditor'],
|
Zeile 1161 | Zeile 1179 |
---|
"awaydate" => (int)$user['away']['date'], "returndate" => $user['away']['returndate'], "awayreason" => $db->escape_string($user['away']['awayreason']),
|
"awaydate" => (int)$user['away']['date'], "returndate" => $user['away']['returndate'], "awayreason" => $db->escape_string($user['away']['awayreason']),
|
"notepad" => $db->escape_string($user['notepad']),
| |
"referrer" => (int)$user['referrer_uid'], "referrals" => 0, "buddylist" => '',
| "referrer" => (int)$user['referrer_uid'], "referrals" => 0, "buddylist" => '',
|
Zeile 1332 | Zeile 1349 |
---|
if(isset($user['website'])) { $this->user_update_data['website'] = $db->escape_string($user['website']);
|
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['skype'])) {
| } if(isset($user['skype'])) {
|
Zeile 1348 | Zeile 1361 |
---|
if(isset($user['bday'])) { $this->user_update_data['birthday'] = $user['bday'];
|
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['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['style'])) { $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['timezone'])) { $this->user_update_data['timezone'] = $db->escape_string($user['timezone']);
|
Zeile 1371 | Zeile 1384 |
---|
} if(isset($user['regip'])) {
|
} if(isset($user['regip'])) {
|
$this->user_update_data['regip'] = $db->escape_string($user['regip']);
| $this->user_update_data['regip'] = $db->escape_binary($user['regip']); } if(isset($user['lastip'])) { $this->user_update_data['lastip'] = $db->escape_binary($user['lastip']);
|
} if(isset($user['language'])) {
| } if(isset($user['language'])) {
|
Zeile 1407 | Zeile 1424 |
---|
$old_user = get_user($user['uid']);
// If old user has new pmnotice and new user has = yes, keep old value
|
$old_user = get_user($user['uid']);
// If old user has new pmnotice and new user has = yes, keep old value
|
if($old_user['pmnotice'] == "2" && $this->user_update_data['pmnotice'] == 1)
| if(isset($this->user_update_data['pmnotice']) && $old_user['pmnotice'] == "2" && $this->user_update_data['pmnotice'] == 1)
|
{ unset($this->user_update_data['pmnotice']); }
| { unset($this->user_update_data['pmnotice']); }
|
Zeile 1441 | Zeile 1458 |
---|
{ $query = $db->simple_select("userfields", "*", "ufid='{$user['uid']}'"); $fields = $db->fetch_array($query);
|
{ $query = $db->simple_select("userfields", "*", "ufid='{$user['uid']}'"); $fields = $db->fetch_array($query);
|
if(!$fields['ufid'])
| if(empty($fields['ufid']))
|
{ $user_fields = array( 'ufid' => $user['uid']
| { $user_fields = array( 'ufid' => $user['uid']
|
Zeile 1744 | Zeile 1761 |
---|
$update = array( "website" => "", "birthday" => "",
|
$update = array( "website" => "", "birthday" => "",
|
"icq" => "",
| |
"skype" => "", "google" => "", "usertitle" => "",
| "skype" => "", "google" => "", "usertitle" => "",
|
Zeile 1786 | Zeile 1802 |
---|
public function verify_signature() { global $mybb, $parser;
|
public function verify_signature() { global $mybb, $parser;
|
| if(!isset($this->data['signature'])) { return true; }
|
if(!isset($parser)) { require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser;
|
if(!isset($parser)) { require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser;
|
}
| }
|
$parser_options = array( 'allow_html' => $mybb->settings['sightml'], 'allow_mycode' => $mybb->settings['sigmycode'],
| $parser_options = array( 'allow_html' => $mybb->settings['sightml'], 'allow_mycode' => $mybb->settings['sigmycode'],
|
Zeile 1810 | Zeile 1831 |
---|
) { $imgsallowed = 0;
|
) { $imgsallowed = 0;
|
|
|
if($mybb->settings['sigimgcode'] == 1) { $imgsallowed = $mybb->settings['maxsigimages'];
| if($mybb->settings['sigimgcode'] == 1) { $imgsallowed = $mybb->settings['maxsigimages'];
|
Zeile 1822 | Zeile 1843 |
---|
if($mybb->settings['sigcountmycode'] == 0) { $parsed_sig = $parser->text_parse_message($this->data['signature'], array('signature_parse' => '1'));
|
if($mybb->settings['sigcountmycode'] == 0) { $parsed_sig = $parser->text_parse_message($this->data['signature'], array('signature_parse' => '1'));
|
}
| }
|
else { $parsed_sig = $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'])
| if($mybb->settings['siglength'] > 0)
|
{
|
{
|
$this->set_error('sig_too_long', array($mybb->settings['siglength']));
if($sig_length - $mybb->settings['siglength'] > 1)
| $parsed_sig = preg_replace("#\s#", "", $parsed_sig); $sig_length = my_strlen($parsed_sig);
if($sig_length > $mybb->settings['siglength'])
|
{
|
{
|
$this->set_error('sig_remove_chars_plural', array($sig_length-$mybb->settings['siglength'])); } else { $this->set_error('sig_remove_chars_singular');
| $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'); }
|
} }
| } }
|