Vergleich inc/datahandlers/user.php - 1.8.7 - 1.8.16

  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.
if($mybb->settings['requirecomplexpasswords'] == 1)
{

		// See if the board has "require complex passwords" enabled.
if($mybb->settings['requirecomplexpasswords'] == 1)
{

Zeile 203Zeile 208
				$this->set_error('no_complex_characters', array($mybb->settings['minpasswordlength']));
return false;
}

				$this->set_error('no_complex_characters', array($mybb->settings['minpasswordlength']));
return false;
}

		}


		}


		// If we have a "password2" check if they both match
if(isset($user['password2']) && $user['password'] !== $user['password2'])
{
$this->set_error("passwords_dont_match");

		// If we have a "password2" check if they both match
if(isset($user['password2']) && $user['password'] !== $user['password2'])
{
$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
$user['saltedpw'] = salt_password($user['md5password'], $user['salt']);


			return false;
}











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


return true;
}

Zeile 265Zeile 265
		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 276
			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');

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

Zeile 288Zeile 288
		if(isset($user['email2']) && $user['email'] != $user['email2'])
{
$this->set_error("emails_dont_match");

		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 303Zeile 303
	{
$website = &$this->data['website'];


	{
$website = &$this->data['website'];


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

if(!filter_var($website, FILTER_VALIDATE_URL))

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

if(!empty($website) && !my_validate_url($website))









		{
$this->set_error('invalid_website');

		{
$this->set_error('invalid_website');

			return false;
}

return true;
}

			return false;
}

return true;
}


/**
* Verifies if an ICQ number is valid or not.


/**
* Verifies if an ICQ number is valid or not.

Zeile 369Zeile 361
		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;
}
}


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

		{
// Error if birth date is in future
if($birthday['month'] > date("m") || ($birthday['month'] == date("m") && $birthday['day'] > date("d")))
{
$this->set_error("invalid_birthday");

				return false;
}
}


				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 423Zeile 415
			$user['bday'] = $birthday['day']."-".$birthday['month']."-";
}
else

			$user['bday'] = $birthday['day']."-".$birthday['month']."-";
}
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 446Zeile 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.
*
* @return boolean True when valid, false when invalid.

	* Verifies if the post count field is filled in correctly.
*
* @return boolean True when valid, false when invalid.

Zeile 471Zeile 463

/**
* Verifies if the thread count field is filled in correctly.


/**
* Verifies if the thread count field is filled in correctly.

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

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

	*/
function verify_threadnum()
{

	*/
function verify_threadnum()
{

Zeile 545Zeile 537
					}
}
elseif(($type == "multiselect" || $type == "checkbox") && $profile_fields[$field] == "" && $profilefield['required'] == 1 && !defined('IN_ADMINCP') && THIS_SCRIPT != "modcp.php")

					}
}
elseif(($type == "multiselect" || $type == "checkbox") && $profile_fields[$field] == "" && $profilefield['required'] == 1 && !defined('IN_ADMINCP') && THIS_SCRIPT != "modcp.php")

				{

				{

					$this->set_error('missing_required_profile_field', array($profilefield['name']));
}


					$this->set_error('missing_required_profile_field', array($profilefield['name']));
}


Zeile 560Zeile 552
						if(!in_array(htmlspecialchars_uni($value), $expoptions))
{
$this->set_error('bad_profile_field_values', array($profilefield['name']));

						if(!in_array(htmlspecialchars_uni($value), $expoptions))
{
$this->set_error('bad_profile_field_values', array($profilefield['name']));

						}

						}

						if($options)
{
$options .= "\n";

						if($options)
{
$options .= "\n";

Zeile 569Zeile 561
					}
}
elseif($type == "select" || $type == "radio")

					}
}
elseif($type == "select" || $type == "radio")

				{

				{

					$expoptions = explode("\n", $thing[1]);
$expoptions = array_map('trim', $expoptions);
if(!in_array(htmlspecialchars_uni($profile_fields[$field]), $expoptions) && trim($profile_fields[$field]) != "")
{
$this->set_error('bad_profile_field_values', array($profilefield['name']));

					$expoptions = explode("\n", $thing[1]);
$expoptions = array_map('trim', $expoptions);
if(!in_array(htmlspecialchars_uni($profile_fields[$field]), $expoptions) && trim($profile_fields[$field]) != "")
{
$this->set_error('bad_profile_field_values', array($profilefield['name']));

					}
$options = $db->escape_string($profile_fields[$field]);
}

					}
$options = $db->escape_string($profile_fields[$field]);
}

				else
{
if($profilefield['maxlength'] > 0 && my_strlen($profile_fields[$field]) > $profilefield['maxlength'])
{
$this->set_error('max_limit_reached', array($profilefield['name'], $profilefield['maxlength']));

				else
{
if($profilefield['maxlength'] > 0 && my_strlen($profile_fields[$field]) > $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 593Zeile 585
					$options = $db->escape_string($profile_fields[$field]);
}
$user['user_fields'][$field] = $options;

					$options = $db->escape_string($profile_fields[$field]);
}
$user['user_fields'][$field] = $options;

			}
}

			}
}


return true;
}


return true;
}





	/**
* Verifies if an optionally entered referrer exists or not.
*

	/**
* Verifies if an optionally entered referrer exists or not.
*

Zeile 607Zeile 599
	function verify_referrer()
{
global $db, $mybb;

	function verify_referrer()
{
global $db, $mybb;





		$user = &$this->data;

// Does the referrer exist or not?

		$user = &$this->data;

// Does the referrer exist or not?

Zeile 619Zeile 611
			{
$this->set_error('invalid_referrer', array($user['referrer']));
return false;

			{
$this->set_error('invalid_referrer', array($user['referrer']));
return false;

			}

			}


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


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

Zeile 668Zeile 660
		else
{
$this->verify_yesno_option($options, 'classicpostbit', 0);

		else
{
$this->verify_yesno_option($options, 'classicpostbit', 0);

		}

		}


if(array_key_exists('subscriptionmethod', $options))
{


if(array_key_exists('subscriptionmethod', $options))
{

Zeile 694Zeile 686
		{
$options['dst'] = 1;
}

		{
$options['dst'] = 1;
}

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

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

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

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

Zeile 765Zeile 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.

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

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

	 */
function verify_regdate()
{

	 */
function verify_regdate()
{

Zeile 791Zeile 783
	 * @return boolean True when valid, false when invalid.
*/
function verify_lastvisit()

	 * @return boolean True when valid, false when invalid.
*/
function verify_lastvisit()

	{

	{

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

		if($lastvisit <= 0)
{
$lastvisit = TIME_NOW;
}
return true;





	}

/**

	}

/**

Zeile 816Zeile 808
		$lastactive = (int)$lastactive;
// If the timestamp is below 0, set it to the current time.
if($lastactive <= 0)

		$lastactive = (int)$lastactive;
// If the timestamp is below 0, set it to the current time.
if($lastactive <= 0)

		{

		{

			$lastactive = TIME_NOW;
}
return true;

			$lastactive = TIME_NOW;
}
return true;

Zeile 842Zeile 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 863Zeile 863
	 * @return boolean True when valid, false when invalid.
*/
function verify_language()

	 * @return boolean True when valid, false when invalid.
*/
function verify_language()

	{
global $lang;

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

	{
global $lang;

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


// An invalid language has been specified?
if($language != '' && !$lang->language_exists($language))


// An invalid language has been specified?
if($language != '' && !$lang->language_exists($language))

Zeile 889Zeile 889
		$user = &$this->data;

if($user['style'])

		$user = &$this->data;

if($user['style'])

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

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


if(empty($theme) || !is_member($theme['allowedgroups'], $user) && $theme['allowedgroups'] != 'all')
{


if(empty($theme) || !is_member($theme['allowedgroups'], $user) && $theme['allowedgroups'] != 'all')
{

Zeile 921Zeile 921
	}

/**

	}

/**

	 * Verifies if the user timezone is valid. 

	 * Verifies if the user timezone is valid.

	 * If the timezone is invalid, the board default is used.
*
* @return boolean True when timezone was valid, false otherwise

	 * If the timezone is invalid, the board default is used.
*
* @return boolean True when timezone was valid, false otherwise

Zeile 940Zeile 940

return true;
}


return true;
}





	/**
* Validate all user assets.
*

	/**
* Validate all user assets.
*

Zeile 988Zeile 988
			$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 1054Zeile 1054
		if($this->method == "insert" || array_key_exists('style', $user))
{
$this->verify_style();

		if($this->method == "insert" || array_key_exists('style', $user))
{
$this->verify_style();

 
		}
if($this->method == "insert" || array_key_exists('signature', $user))
{
$this->verify_signature();

		}

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

		}

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

Zeile 1091Zeile 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 1102Zeile 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 1119Zeile 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 1179Zeile 1182
		{
$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;
}

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

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

$this->uid = $db->insert_query("users", $this->user_insert_data);

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

$this->uid = $db->insert_query("users", $this->user_insert_data);





		$user['user_fields']['ufid'] = $this->uid;

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

		$user['user_fields']['ufid'] = $this->uid;

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

Zeile 1236Zeile 1239

return $this->return_values;
}


return $this->return_values;
}





	/**
* Updates a user in the database.
*

	/**
* Updates a user in the database.
*

Zeile 1265Zeile 1268
		{
$this->user_update_data['username'] = $db->escape_string($user['username']);
}

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

		if(isset($user['saltedpw']))





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

		{

		{

			$this->user_update_data['password'] = $user['saltedpw'];

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

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

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




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

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

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

		{

		{

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

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

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

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

		{

		{

			$this->user_update_data['threadnum'] = (int)$user['threadnum'];
}
if(isset($user['avatar']))
{
$this->user_update_data['avatar'] = $db->escape_string($user['avatar']);
$this->user_update_data['avatartype'] = $db->escape_string($user['avatartype']);

			$this->user_update_data['threadnum'] = (int)$user['threadnum'];
}
if(isset($user['avatar']))
{
$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['usergroup']))
{
$this->user_update_data['usergroup'] = (int)$user['usergroup'];

Zeile 1327Zeile 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 1363Zeile 1368
		if(isset($user['dateformat']))
{
$this->user_update_data['dateformat'] = $db->escape_string($user['dateformat']);

		if(isset($user['dateformat']))
{
$this->user_update_data['dateformat'] = $db->escape_string($user['dateformat']);

		}

		}

		if(isset($user['timeformat']))
{
$this->user_update_data['timeformat'] = $db->escape_string($user['timeformat']);
}
if(isset($user['regip']))

		if(isset($user['timeformat']))
{
$this->user_update_data['timeformat'] = $db->escape_string($user['timeformat']);
}
if(isset($user['regip']))

		{

		{

			$this->user_update_data['regip'] = $db->escape_string($user['regip']);
}
if(isset($user['language']))
{
$this->user_update_data['language'] = $db->escape_string($user['language']);

			$this->user_update_data['regip'] = $db->escape_string($user['regip']);
}
if(isset($user['language']))
{
$this->user_update_data['language'] = $db->escape_string($user['language']);

		}

		}

		if(isset($user['away']))
{

		if(isset($user['away']))
{

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

			$this->user_update_data['away'] = (int)$user['away']['away'];

			$this->user_update_data['awaydate'] = $db->escape_string($user['away']['date']);
$this->user_update_data['returndate'] = $db->escape_string($user['away']['returndate']);
$this->user_update_data['awayreason'] = $db->escape_string($user['away']['awayreason']);

			$this->user_update_data['awaydate'] = $db->escape_string($user['away']['date']);
$this->user_update_data['returndate'] = $db->escape_string($user['away']['returndate']);
$this->user_update_data['awayreason'] = $db->escape_string($user['away']['awayreason']);

		}

		}

		if(isset($user['notepad']))
{
$this->user_update_data['notepad'] = $db->escape_string($user['notepad']);
}
if(isset($user['usernotes']))

		if(isset($user['notepad']))
{
$this->user_update_data['notepad'] = $db->escape_string($user['notepad']);
}
if(isset($user['usernotes']))

		{

		{

			$this->user_update_data['usernotes'] = $db->escape_string($user['usernotes']);
}
if(isset($user['options']) && is_array($user['options']))

			$this->user_update_data['usernotes'] = $db->escape_string($user['usernotes']);
}
if(isset($user['options']) && is_array($user['options']))

Zeile 1401Zeile 1406
		if(array_key_exists('coppa_user', $user))
{
$this->user_update_data['coppauser'] = (int)$user['coppa_user'];

		if(array_key_exists('coppa_user', $user))
{
$this->user_update_data['coppauser'] = (int)$user['coppa_user'];

		}

		}

		// First, grab the old user details for later use.
$old_user = get_user($user['uid']);


		// First, grab the old user details for later use.
$old_user = get_user($user['uid']);


Zeile 1409Zeile 1414
		if($old_user['pmnotice'] == "2" && $this->user_update_data['pmnotice'] == 1)
{
unset($this->user_update_data['pmnotice']);

		if($old_user['pmnotice'] == "2" && $this->user_update_data['pmnotice'] == 1)
{
unset($this->user_update_data['pmnotice']);

		}

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

		}

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


if(count($this->user_update_data) < 1 && empty($user['user_fields']))
{


if(count($this->user_update_data) < 1 && empty($user['user_fields']))
{

Zeile 1458Zeile 1463
				$db->insert_query("userfields", $user_fields);
}
$db->update_query("userfields", $user['user_fields'], "ufid='{$user['uid']}'", false);

				$db->insert_query("userfields", $user_fields);
}
$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.
if(!empty($this->user_update_data['username']) && $this->user_update_data['username'] != $old_user['username'])
{

		// Let's make sure the user's name gets changed everywhere in the db if it changed.
if(!empty($this->user_update_data['username']) && $this->user_update_data['username'] != $old_user['username'])
{

Zeile 1580Zeile 1585

$this->return_values = array(
"deleted_users" => $this->deleted_users


$this->return_values = array(
"deleted_users" => $this->deleted_users

		);

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


		);

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


		// Update  cache
$cache->update_banned();
$cache->update_moderators();
$cache->update_forumsdisplay();
$cache->update_reportedcontent();
$cache->update_awaitingactivation();

		// Update  cache
$cache->update_banned();
$cache->update_moderators();
$cache->update_forumsdisplay();
$cache->update_reportedcontent();
$cache->update_awaitingactivation();

 
		$cache->update_birthdays();


return $this->return_values;
}


return $this->return_values;
}

Zeile 1600Zeile 1606
	 * @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'])

	{
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]);
}
}

				{
// Remove super admins
unset($this->delete_uids[$key]);
}
}

		



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


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


Zeile 1654Zeile 1660

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

		}
}


		}
}


Zeile 1669Zeile 1675
	 * @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)

	 * @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]);
}
}

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


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

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

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

			"aim" => "",

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

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

Zeile 1782Zeile 1787
		{
remove_avatars($uid);
}

		{
remove_avatars($uid);
}

 
	}

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

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,
'allow_mycode' => $mybb->settings['sigmycode'],
'allow_smilies' => $mybb->settings['sigsmilies'],
'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) &&
substr_count($parsed_sig, "<img") > 0) ||
(($mybb->settings['sigimgcode'] == 1 || $mybb->settings['sigsmilies'] == 1) &&
substr_count($parsed_sig, "<img") > $mybb->settings['maxsigimages'])
)
{
$imgsallowed = 0;

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

$this->set_error('too_many_sig_images2', array($imgsallowed));
}

if($mybb->settings['sigcountmycode'] == 0)
{
$parsed_sig = $parser->text_parse_message($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'])
{
$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');
}
}

if(count($this->get_errors()) > 0)
{
return false;
}
return true;

	}
}

	}
}