Vergleich inc/datahandlers/user.php - 1.4.4 - 1.4.9

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 1Zeile 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 4261 2008-11-03 01:11: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 70Zeile 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 220Zeile 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 228Zeile 229
	function verify_email()
{
global $mybb;

	function verify_email()
{
global $mybb;





		$user = &$this->data;

// Check if an email address has actually been entered.
if(trim($user['email']) == '')

		$user = &$this->data;

// Check if an email address has actually been entered.
if(trim($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 247Zeile 248

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

		}

		}

		
// 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 261Zeile 262
				$this->set_error('email_already_in_use');
return false;
}

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

		}


		}


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

Zeile 273Zeile 274

/**
* Verifies if a website is valid or not.


/**
* Verifies if a website is valid or not.

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

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

	function verify_website()
{
$website = &$this->data['website'];

	function verify_website()
{
$website = &$this->data['website'];

Zeile 304Zeile 305
	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");

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

Zeile 333Zeile 334

/**
* Verifies if a birthday is valid or not.


/**
* Verifies if a birthday is valid or not.

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

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

	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 352Zeile 353
		$birthday['day'] = intval($birthday['day']);
$birthday['month'] = intval($birthday['month']);
$birthday['year'] = intval($birthday['year']);

		$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 688Zeile 686
		if($lastactive <= 0)
{
$lastactive = TIME_NOW;

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

		}
return true;


		}
return true;


	}

/**

	}

/**

Zeile 858Zeile 856
		{
$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 967Zeile 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 984Zeile 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 1102Zeile 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 1158Zeile 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 1197Zeile 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.