Vergleich inc/datahandlers/user.php - 1.8.10 - 1.8.20

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 187Zeile 187
		}

// 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'])

		if(!empty($user['email']) && !empty($user['username']))

		{

		{

			$this->set_error('bad_password_security');
return false;






			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 211Zeile 216
			$this->set_error("passwords_dont_match");
return false;
}

			$this->set_error("passwords_dont_match");
return false;
}


// Generate our salt
$user['salt'] = generate_salt();

// Combine the password and 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();








// Combine the password and salt
$password_fields = create_password($user['password'], false, $user);
$user = array_merge($user, $password_fields);


		return true;
}

/**
* Verifies usergroup selections and other group details.

		return true;
}

/**
* Verifies usergroup selections and other group details.

	*
* @return boolean True when valid, false when invalid.

	*
* @return boolean True when valid, false when invalid.

	*/
function verify_usergroup()
{

	*/
function verify_usergroup()
{

Zeile 241Zeile 244
	function verify_email()
{
global $mybb;

	function verify_email()
{
global $mybb;


$user = &$this->data;



$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 260Zeile 263

// Check banned emails
if(is_banned_email($user['email'], true))


// Check banned emails
if(is_banned_email($user['email'], true))

		{

		{

			$this->set_error('banned_email');
return false;
}

			$this->set_error('banned_email');
return false;
}

Zeile 308Zeile 311
		if(!empty($website) && !my_validate_url($website))
{
$this->set_error('invalid_website');

		if(!empty($website) && !my_validate_url($website))
{
$this->set_error('invalid_website');

			return false;
}

return true;
}

/**

			return false;
}

return true;
}

/**

	 * Verifies if an ICQ number is valid or not.
*
* @return boolean True when valid, false when invalid.

	 * Verifies if an ICQ number is valid or not.
*
* @return boolean True when valid, false when invalid.

Zeile 322Zeile 325
	function verify_icq()
{
$icq = &$this->data['icq'];

	function verify_icq()
{
$icq = &$this->data['icq'];





		if($icq != '' && !is_numeric($icq))
{
$this->set_error("invalid_icq_number");
return false;
}
$icq = (int)$icq;

		if($icq != '' && !is_numeric($icq))
{
$this->set_error("invalid_icq_number");
return false;
}
$icq = (int)$icq;

		return true;
}

/**

		return true;
}

/**

	* Verifies if a birthday is valid or not.
*
* @return boolean True when valid, false when invalid.

	* Verifies if a birthday is valid or not.
*
* @return boolean True when valid, false when invalid.

Zeile 367Zeile 370
		// Check if the day actually exists.
$months = get_bdays($birthday['year']);
if($birthday['month'] != 0 && $birthday['day'] > $months[$birthday['month']-1])

		// Check if the day actually exists.
$months = get_bdays($birthday['year']);
if($birthday['month'] != 0 && $birthday['day'] > $months[$birthday['month']-1])

		{
$this->set_error("invalid_birthday");
return false;
}

		{
$this->set_error("invalid_birthday");
return false;
}


// Error if a year exists and the year is out of range
if($birthday['year'] != 0 && ($birthday['year'] < (date("Y")-100)) || $birthday['year'] > date("Y"))


// Error if a year exists and the year is out of range
if($birthday['year'] != 0 && ($birthday['year'] < (date("Y")-100)) || $birthday['year'] > date("Y"))

		{

		{

			$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 386Zeile 389
				$this->set_error("invalid_birthday");
return false;
}

				$this->set_error("invalid_birthday");
return false;
}

		}

		}


// Error if COPPA is on, and the user hasn't verified their age / under 13
if($mybb->settings['coppa'] == "enabled" && ($birthday['year'] == 0 || !$birthday['year']))


// Error if COPPA is on, and the user hasn't verified their age / under 13
if($mybb->settings['coppa'] == "enabled" && ($birthday['year'] == 0 || !$birthday['year']))

Zeile 435Zeile 438
		if(!in_array($birthdayprivacy, $accepted))
{
$this->set_error("invalid_birthday_privacy");

		if(!in_array($birthdayprivacy, $accepted))
{
$this->set_error("invalid_birthday_privacy");

			return false;
}
return true;
}

			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 470Zeile 473
		if(isset($user['threadnum']) && $user['threadnum'] < 0)
{
$this->set_error("invalid_threadnum");

		if(isset($user['threadnum']) && $user['threadnum'] < 0)
{
$this->set_error("invalid_threadnum");

			return false;
}

return true;

			return false;
}

return true;

	}

/**

	}

/**

Zeile 541Zeile 544
				// 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 574Zeile 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 612Zeile 615

$user['referrer_uid'] = $referrer['uid'];
}


$user['referrer_uid'] = $referrer['uid'];
}

		else
{
$user['referrer_uid'] = 0;
}

		else
{
$user['referrer_uid'] = 0;
}


return true;
}


return true;
}

Zeile 666Zeile 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

		if(array_key_exists('dstcorrection', $options))
{
// Value out of range

Zeile 677Zeile 680
			{
$options['dstcorrection'] = 0;
}

			{
$options['dstcorrection'] = 0;
}

		}

		}


if($options['dstcorrection'] == 1)
{
$options['dst'] = 1;
}


if($options['dstcorrection'] == 1)
{
$options['dst'] = 1;
}

		else if($options['dstcorrection'] == 0)

		elseif($options['dstcorrection'] == 0)

		{
$options['dst'] = 0;

		{
$options['dst'] = 0;

		}

		}


if($this->method == "insert" || (isset($options['threadmode']) && $options['threadmode'] != "linear" && $options['threadmode'] != "threaded"))
{


if($this->method == "insert" || (isset($options['threadmode']) && $options['threadmode'] != "linear" && $options['threadmode'] != "threaded"))
{

Zeile 754Zeile 757
			}
}
$this->data['options'] = $options;

			}
}
$this->data['options'] = $options;

	}


	}


	/**
* Verifies if a registration date is valid or not.
*

	/**
* Verifies if a registration date is valid or not.
*

Zeile 770Zeile 773
		if($regdate <= 0)
{
$regdate = TIME_NOW;

		if($regdate <= 0)
{
$regdate = TIME_NOW;

		}
return true;
}

/**

		}
return true;
}

/**

	 * Verifies if a last visit date is valid or not.
*
* @return boolean True when valid, false when invalid.

	 * Verifies if a last visit date is valid or not.
*
* @return boolean True when valid, false when invalid.

Zeile 784Zeile 787
		$lastvisit = &$this->data['lastvisit'];

$lastvisit = (int)$lastvisit;

		$lastvisit = &$this->data['lastvisit'];

$lastvisit = (int)$lastvisit;

		// 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($lastvisit <= 0)
{
$lastvisit = TIME_NOW;

		if($lastvisit <= 0)
{
$lastvisit = TIME_NOW;

		}
return true;

}

/**

		}
return true;

}

/**

	 * Verifies if a last active date is valid or not.
*
* @return boolean True when valid, false when invalid.

	 * Verifies if a last active date is valid or not.
*
* @return boolean True when valid, false when invalid.

Zeile 831Zeile 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 917Zeile 928
	 */
function verify_timezone()
{

	 */
function verify_timezone()
{

		global $mybb;


 
		$user = &$this->data;

$timezones = get_supported_timezones();

		$user = &$this->data;

$timezones = get_supported_timezones();

Zeile 1086Zeile 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 1097Zeile 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 1114Zeile 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 1169Zeile 1177
			"classicpostbit" => (int)$user['options']['classicpostbit'],
"usernotes" => ''
);

			"classicpostbit" => (int)$user['options']['classicpostbit'],
"usernotes" => ''
);





		if($user['options']['dstcorrection'] == 1)

		if($user['options']['dstcorrection'] == 1)

		{

		{

			$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;
}

$plugins->run_hooks("datahandler_user_insert", $this);

		{
$this->user_insert_data['dst'] = 0;
}

$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;





		$pfcache = $cache->read('profilefields');

		$pfcache = $cache->read('profilefields');





		if(is_array($pfcache))
{
foreach($pfcache as $profile_field)

		if(is_array($pfcache))
{
foreach($pfcache as $profile_field)

Zeile 1197Zeile 1205
				}
$user['user_fields']["fid{$profile_field['fid']}"] = '';
}

				}
$user['user_fields']["fid{$profile_field['fid']}"] = '';
}

		}


		}


		$db->insert_query("userfields", $user['user_fields'], false);

if($this->user_insert_data['referrer'] != 0)

		$db->insert_query("userfields", $user['user_fields'], false);

if($this->user_insert_data['referrer'] != 0)

Zeile 1249Zeile 1257
		if(count($this->get_errors()) > 0)
{
die("The user is not valid.");

		if(count($this->get_errors()) > 0)
{
die("The user is not valid.");

		}


		}


		$user = &$this->data;
$user['uid'] = (int)$user['uid'];
$this->uid = $user['uid'];

// Set up the update data.
if(isset($user['username']))

		$user = &$this->data;
$user['uid'] = (int)$user['uid'];
$this->uid = $user['uid'];

// Set up the update data.
if(isset($user['username']))

		{

		{

			$this->user_update_data['username'] = $db->escape_string($user['username']);

			$this->user_update_data['username'] = $db->escape_string($user['username']);

		}
if(isset($user['saltedpw']))
{
$this->user_update_data['password'] = $user['saltedpw'];




		}
if(isset($user['password']))
{
$this->user_update_data['password'] = $user['password'];
}
if(isset($user['salt']))
{

			$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']))
{

			$this->user_update_data['email'] = $user['email'];

			$this->user_update_data['email'] = $db->escape_string($user['email']);

		}
if(isset($user['postnum']))

		}
if(isset($user['postnum']))

		{

		{

			$this->user_update_data['postnum'] = (int)$user['postnum'];
}
if(isset($user['threadnum']))

			$this->user_update_data['postnum'] = (int)$user['postnum'];
}
if(isset($user['threadnum']))

Zeile 1282Zeile 1296
		{
$this->user_update_data['avatar'] = $db->escape_string($user['avatar']);
$this->user_update_data['avatartype'] = $db->escape_string($user['avatartype']);

		{
$this->user_update_data['avatar'] = $db->escape_string($user['avatar']);
$this->user_update_data['avatartype'] = $db->escape_string($user['avatartype']);

		}

		}

		if(isset($user['usergroup']))
{
$this->user_update_data['usergroup'] = (int)$user['usergroup'];
}
if(isset($user['additionalgroups']))

		if(isset($user['usergroup']))
{
$this->user_update_data['usergroup'] = (int)$user['usergroup'];
}
if(isset($user['additionalgroups']))

		{

		{

			$this->user_update_data['additionalgroups'] = $db->escape_string($user['additionalgroups']);
}
if(isset($user['displaygroup']))

			$this->user_update_data['additionalgroups'] = $db->escape_string($user['additionalgroups']);
}
if(isset($user['displaygroup']))

Zeile 1300Zeile 1314
			$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 1322Zeile 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']))
{

		}
if(isset($user['yahoo']))
{

Zeile 1585Zeile 1595
		$cache->update_forumsdisplay();
$cache->update_reportedcontent();
$cache->update_awaitingactivation();

		$cache->update_forumsdisplay();
$cache->update_reportedcontent();
$cache->update_awaitingactivation();

 
		$cache->update_birthdays();


return $this->return_values;
}


return $this->return_values;
}

Zeile 1739Zeile 1750
			"website" => "",
"birthday" => "",
"icq" => "",

			"website" => "",
"birthday" => "",
"icq" => "",

			"aim" => "",

 
			"yahoo" => "",
"skype" => "",
"google" => "",

			"yahoo" => "",
"skype" => "",
"google" => "",

Zeile 1818Zeile 1828

if($mybb->settings['sigcountmycode'] == 0)
{


if($mybb->settings['sigcountmycode'] == 0)
{

			$parsed_sig = $parser->text_parse_message($this->data['signature']);

			$parsed_sig = $parser->text_parse_message($this->data['signature'], array('signature_parse' => '1'));

		}
else
{

		}
else
{