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

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 211Zeile 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 238Zeile 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;

	function verify_email()
{
global $mybb;





		$user = &$this->data;

// Check if an email address has actually been entered.
if(trim_blank_chrs($user['email']) == '')
{
$this->set_error('missing_email');

		$user = &$this->data;

// Check if an email address has actually been entered.
if(trim_blank_chrs($user['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']))

		{

		{

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

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

Zeile 265Zeile 262
		if(is_banned_email($user['email'], true))
{
$this->set_error('banned_email');

		if(is_banned_email($user['email'], true))
{
$this->set_error('banned_email');

			return false;
}


			return false;
}


		// Check signed up emails
// 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"))

		// Check signed up emails
// 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"))

Zeile 276Zeile 273
			if(isset($user['uid']))
{
$uid = $user['uid'];

			if(isset($user['uid']))
{
$uid = $user['uid'];

			}

			}

			if(email_already_in_use($user['email'], $uid))
{
$this->set_error('email_already_in_use');
return false;
}

			if(email_already_in_use($user['email'], $uid))
{
$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'])
{
$this->set_error("emails_dont_match");


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

return true;
}


			return false;
}

return true;
}


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

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

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

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





		if(!empty($website) && !my_validate_url($website))
{
$website = 'http://'.$website;

		if(!empty($website) && !my_validate_url($website))
{
$website = 'http://'.$website;

Zeile 311Zeile 308
		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;

	}

/**

	}

/**

Zeile 361Zeile 358
		if($birthday['day'] != 0 || $birthday['month'] != 0)
{
if($birthday['day'] < 1 || $birthday['day'] > 31 || $birthday['month'] < 1 || $birthday['month'] > 12 || ($birthday['month'] == 2 && $birthday['day'] > 29))

		if($birthday['day'] != 0 || $birthday['month'] != 0)
{
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;

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

			}
}


			}
}


Zeile 413Zeile 410
		{
// 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

		}
else

		{
// No field is specified, so return an empty string for an unknown birthday
$user['bday'] = '';

		{
// No field is specified, so return an empty string for an unknown birthday
$user['bday'] = '';

Zeile 810Zeile 807
		if($lastactive <= 0)
{
$lastactive = TIME_NOW;

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

		}
return true;


		}
return true;


	}

/**

	}

/**

Zeile 851Zeile 848

/**
* Verifies if a language is valid for this user or not.


/**
* Verifies if a language is valid for this user or not.

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

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

	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))
{
$this->set_error("invalid_language");

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

// An invalid language has been specified?
if($language != '' && !$lang->language_exists($language))
{
$this->set_error("invalid_language");

			return false;
}
return true;

			return false;
}
return true;

	}

/**

	}

/**

Zeile 877Zeile 874
	function verify_style()
{
global $lang;

	function verify_style()
{
global $lang;


$user = &$this->data;



$user = &$this->data;


		if($user['style'])
{
$theme = get_theme($user['style']);

		if($user['style'])
{
$theme = get_theme($user['style']);

Zeile 889Zeile 886
				$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 920Zeile 917
	 */
function verify_timezone()
{

	 */
function verify_timezone()
{

 
		global $mybb;


		$user = &$this->data;

$timezones = get_supported_timezones();

		$user = &$this->data;

$timezones = get_supported_timezones();

Zeile 1209Zeile 1208
				SET referrals=referrals+1
WHERE uid='{$this->user_insert_data['referrer']}'
");

				SET referrals=referrals+1
WHERE uid='{$this->user_insert_data['referrer']}'
");

		}


		}


		// Update forum stats
update_stats(array('numusers' => '+1'));


		// Update forum stats
update_stats(array('numusers' => '+1'));


Zeile 1596Zeile 1595
	 * @param array|bool $delete_uids Array of user ids, false if they're already set (eg when using the delete_user function)
*/
function delete_content($delete_uids=false)

	 * @param array|bool $delete_uids Array of user ids, false if they're already set (eg when using the delete_user function)
*/
function delete_content($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)
{
if(!$uid || is_super_admin($uid) || $uid == $mybb->user['uid'])
{
// Remove super admins
unset($this->delete_uids[$key]);

	{
global $db, $plugins, $mybb;

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'])
{
// Remove super admins
unset($this->delete_uids[$key]);

				}
}


				}
}


Zeile 1650Zeile 1649

// 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})");


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


	/**
* 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)
{
$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'])
{
// Remove super admins
unset($this->delete_uids[$key]);
}
}

$this->delete_uids = implode(',', $this->delete_uids);
}


	{
global $db, $plugins, $mybb;

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'])
{
// Remove super admins
unset($this->delete_uids[$key]);
}
}

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

		require_once MYBB_ROOT.'inc/class_moderation.php';
$moderation = new Moderation();

$plugins->run_hooks('datahandler_user_delete_posts', $this);

if(empty($this->delete_uids))

		{

		{

			return;

			return;

		}


		}


		// Threads
$query = $db->simple_select('threads', 'tid', "uid IN({$this->delete_uids})");
while($tid = $db->fetch_field($query, 'tid'))

		// Threads
$query = $db->simple_select('threads', 'tid', "uid IN({$this->delete_uids})");
while($tid = $db->fetch_field($query, 'tid'))

Zeile 1706Zeile 1705
		while($pid = $db->fetch_field($query, 'pid'))
{
$moderation->delete_post($pid);

		while($pid = $db->fetch_field($query, 'pid'))
{
$moderation->delete_post($pid);

		}
}


		}
}


	/**
* Provides a method to clear an users profile
*

	/**
* Provides a method to clear an users profile
*

Zeile 1758Zeile 1757
		);

if($gid > 0)

		);

if($gid > 0)

		{

		{

			$update["usergroup"] = (int)$gid;

			$update["usergroup"] = (int)$gid;

		}

$plugins->run_hooks('datahandler_user_clear_profile', $this);

		}

$plugins->run_hooks('datahandler_user_clear_profile', $this);


if(empty($this->delete_uids))


if(empty($this->delete_uids))

		{

		{

			return;

			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})");





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

Zeile 1783Zeile 1782
	public function verify_signature()
{
global $mybb, $parser;

	public function verify_signature()
{
global $mybb, $parser;





		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'],
'filter_badwords' => 1,

		$parser_options = array(
'allow_html' => $mybb->settings['sightml'],
'filter_badwords' => 1,

Zeile 1798Zeile 1797
			'allow_imgcode' => $mybb->settings['sigimgcode'],
"filter_badwords" => 1
);

			'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) &&

		$parsed_sig = $parser->parse_message($this->data['signature'], $parser_options);

if((($mybb->settings['sigimgcode'] == 0 && $mybb->settings['sigsmilies'] != 1) &&

Zeile 1808Zeile 1807
		)
{
$imgsallowed = 0;

		)
{
$imgsallowed = 0;

			



			if($mybb->settings['sigimgcode'] == 1)
{
$imgsallowed = $mybb->settings['maxsigimages'];

			if($mybb->settings['sigimgcode'] == 1)
{
$imgsallowed = $mybb->settings['maxsigimages'];