Vergleich inc/datahandlers/user.php - 1.8.6 - 1.8.21

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


		return true;





		// 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 boolean True when valid, false when invalid.

	* Verifies usergroup selections and other group details.
*
* @return boolean True when valid, false when invalid.

Zeile 238Zeile 238
	}
/**
* 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.
*/
function verify_email()

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

	{
global $mybb;


	{
global $mybb;


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


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


		if(empty($website) || my_strtolower($website) == 'http://' || my_strtolower($website) == 'https://')

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

		{

		{

			$website = '';
return true;
}

// Does the website start with http(s)://?
if(my_strtolower(substr($website, 0, 4)) != "http")

			$website = 'http://'.$website;
}

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



		{

		{

			// Website does not start with http://, let's see if the user forgot.
$website = "http://".$website;

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

		}


		}


		if(!filter_var($website, FILTER_VALIDATE_URL))
{
$this->set_error('invalid_website');
return false;
}

return true;

		return true;







	}

/**

	}

/**

Zeile 389Zeile 381
			$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")))

			{

			{

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

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

Zeile 403Zeile 395
		if($mybb->settings['coppa'] == "enabled" && ($birthday['year'] == 0 || !$birthday['year']))
{
$this->set_error("invalid_birthday_coppa");

		if($mybb->settings['coppa'] == "enabled" && ($birthday['year'] == 0 || !$birthday['year']))
{
$this->set_error("invalid_birthday_coppa");

			return false;
}

			return false;
}

		elseif(($mybb->settings['coppa'] == "deny" && $birthday['year'] > (date("Y")-13)) && !is_moderator())
{
$this->set_error("invalid_birthday_coppa2");

		elseif(($mybb->settings['coppa'] == "deny" && $birthday['year'] > (date("Y")-13)) && !is_moderator())
{
$this->set_error("invalid_birthday_coppa2");

Zeile 416Zeile 408
		{
// If the year is specified, put together a d-m-y string
$user['bday'] = $birthday['day']."-".$birthday['month']."-".$birthday['year'];

		{
// If the year is specified, put together a d-m-y string
$user['bday'] = $birthday['day']."-".$birthday['month']."-".$birthday['year'];

		}

		}

		elseif($birthday['day'] && $birthday['month'])
{
// If only a day and month are specified, put together a d-m string

		elseif($birthday['day'] && $birthday['month'])
{
// If only a day and month are specified, put together a d-m string

Zeile 463Zeile 455
		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 false;
}


return true;
}


return true;
}

Zeile 534Zeile 526
				if(!isset($profile_fields[$field]))
{
$profile_fields[$field] = '';

				if(!isset($profile_fields[$field]))
{
$profile_fields[$field] = '';

				}


				}


				// If the profile field is required, but not filled in, present error.
if($type != "multiselect" && $type != "checkbox")
{

				// If the profile field is required, but not filled in, present error.
if($type != "multiselect" && $type != "checkbox")
{

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

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





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



$user = &$this->data;


		// Does the referrer exist or not?
if($mybb->settings['usereferrals'] == 1 && $user['referrer'] != '')
{

		// Does the referrer exist or not?
if($mybb->settings['usereferrals'] == 1 && $user['referrer'] != '')
{

Zeile 681Zeile 673
		}

if(array_key_exists('dstcorrection', $options))

		}

if(array_key_exists('dstcorrection', $options))

		{

		{

			// Value out of range
$options['dstcorrection'] = (int)$options['dstcorrection'];
if($options['dstcorrection'] < 0 || $options['dstcorrection'] > 2)
{
$options['dstcorrection'] = 0;

			// Value out of range
$options['dstcorrection'] = (int)$options['dstcorrection'];
if($options['dstcorrection'] < 0 || $options['dstcorrection'] > 2)
{
$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;
}

Zeile 706Zeile 698
				$options['threadmode'] = 'threaded';
}
else

				$options['threadmode'] = 'threaded';
}
else

			{

			{

				$options['threadmode'] = 'linear';
}
}

				$options['threadmode'] = 'linear';
}
}

Zeile 715Zeile 707
		if($this->method == "insert" || (array_key_exists('tpp', $options) && $mybb->settings['usertppoptions']))
{
if(!isset($options['tpp']))

		if($this->method == "insert" || (array_key_exists('tpp', $options) && $mybb->settings['usertppoptions']))
{
if(!isset($options['tpp']))

			{

			{

				$options['tpp'] = 0;
}
$explodedtpp = explode(",", $mybb->settings['usertppoptions']);

				$options['tpp'] = 0;
}
$explodedtpp = explode(",", $mybb->settings['usertppoptions']);

Zeile 730Zeile 722
				}
}
$options['tpp'] = (int)$options['tpp'];

				}
}
$options['tpp'] = (int)$options['tpp'];

		}

		}

		// Verify the "posts per page" option.
if($this->method == "insert" || (array_key_exists('ppp', $options) && $mybb->settings['userpppoptions']))
{

		// Verify the "posts per page" option.
if($this->method == "insert" || (array_key_exists('ppp', $options) && $mybb->settings['userpppoptions']))
{

Zeile 777Zeile 769
		$regdate = &$this->data['regdate'];

$regdate = (int)$regdate;

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

$regdate = (int)$regdate;

		// 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($regdate <= 0)

		if($regdate <= 0)

		{

		{

			$regdate = TIME_NOW;

			$regdate = TIME_NOW;

		}
return true;

		}
return true;

	}

/**

	}

/**

Zeile 793Zeile 785
	function verify_lastvisit()
{
$lastvisit = &$this->data['lastvisit'];

	function verify_lastvisit()
{
$lastvisit = &$this->data['lastvisit'];





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

		$lastvisit = (int)$lastvisit;
// If the timestamp is below 0, set it to the current time.
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 825Zeile 817

/**
* Verifies if an away mode status is valid or not.


/**
* Verifies if an away mode status is valid or not.

	 *

	 *

	 * @return boolean True when valid, false when invalid.
*/
function verify_away()
{
global $mybb;

	 * @return boolean True when valid, false when invalid.
*/
function verify_away()
{
global $mybb;





		$user = &$this->data;
// If the board does not allow "away mode" or the user is marking as not away, set defaults.
if($mybb->settings['allowaway'] == 0 || !isset($user['away']['away']) || $user['away']['away'] != 1)

		$user = &$this->data;
// If the board does not allow "away mode" or the user is marking as not away, set defaults.
if($mybb->settings['allowaway'] == 0 || !isset($user['away']['away']) || $user['away']['away'] != 1)

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

			list($returnday, $returnmonth, $returnyear) = explode('-', $user['away']['returndate']);
if(!$returnday || !$returnmonth || !$returnyear)
{
$this->set_error("missing_returndate");

				return false;
}


				return false;
}


			// Validate the return date lengths
$user['away']['returndate'] = substr($returnday, 0, 2).'-'.substr($returnmonth, 0, 2).'-'.substr($returnyear, 0, 4);
}
return true;
}

			// Validate the return date lengths
$user['away']['returndate'] = substr($returnday, 0, 2).'-'.substr($returnmonth, 0, 2).'-'.substr($returnyear, 0, 4);
}
return true;
}





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

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

Zeile 865Zeile 865
	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 false;
}

		return true;
}

		return true;
}





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

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

Zeile 885Zeile 885
	function verify_style()
{
global $lang;

	function verify_style()
{
global $lang;





		$user = &$this->data;

if($user['style'])

		$user = &$this->data;

if($user['style'])

Zeile 896Zeile 896
			{
$this->set_error('invalid_style');
return false;

			{
$this->set_error('invalid_style');
return false;

			}
}

			}
}


return true;
}


return true;
}

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 969Zeile 969
			else
{
unset($user['username']);

			else
{
unset($user['username']);

			}

			}

		}
if($this->method == "insert" || array_key_exists('usertitle', $user))

		}
if($this->method == "insert" || array_key_exists('usertitle', $user))

		{

		{

			$this->verify_usertitle();

			$this->verify_usertitle();

		}

		}

		if($this->method == "insert" || array_key_exists('password', $user))

		if($this->method == "insert" || array_key_exists('password', $user))

		{

		{

			$this->verify_password();

			$this->verify_password();

		}

		}

		if($this->method == "insert" || array_key_exists('usergroup', $user))

		if($this->method == "insert" || array_key_exists('usergroup', $user))

		{

		{

			$this->verify_usergroup();
}
if($this->method == "insert" || array_key_exists('email', $user))
{
$this->verify_email();

			$this->verify_usergroup();
}
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))

		if($this->method == "insert" || array_key_exists('icq', $user))

		{

		{

			$this->verify_icq();

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

		{

		{

			$this->verify_birthday();
}
if($this->method == "insert" || array_key_exists('postnum', $user))
{
$this->verify_postnum();

			$this->verify_birthday();
}
if($this->method == "insert" || array_key_exists('postnum', $user))
{
$this->verify_postnum();

		}

		}

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

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

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 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'];

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

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

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

		}

		}

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

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

		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['additionalgroups']))
{
$this->user_update_data['additionalgroups'] = $db->escape_string($user['additionalgroups']);

Zeile 1313Zeile 1322
			$this->user_update_data['lastactive'] = (int)$user['lastactive'];
}
if(isset($user['lastvisit']))

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

		{

		{

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

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

		}

		}

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

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

		{

		{

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

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

		}

		}

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

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

		{

		{

			$this->user_update_data['icq'] = (int)$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 1378Zeile 1383
		}
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']);

Zeile 1517Zeile 1522
		$plugins->run_hooks('datahandler_user_delete_start', $this);

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

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

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

		












if(empty($this->delete_uids))
{
$this->deleted_users = 0;
$this->return_values = array(
"deleted_users" => $this->deleted_users
);

return $this->return_values;
}


		$this->delete_content();

// Delete the user

		$this->delete_content();

// Delete the user

Zeile 1580Zeile 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 1596Zeile 1612
		if($delete_uids != false)
{
$this->delete_uids = array_map('intval', (array)$delete_uids);

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

			foreach($this->delete_uids as $key => $uid)
{
if(!$uid || is_super_admin($uid) || $uid == $mybb->user['uid'])

Zeile 1605Zeile 1621
					unset($this->delete_uids[$key]);
}
}

					unset($this->delete_uids[$key]);
}
}

		



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

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

		}


		}


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

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

 

if(empty($this->delete_uids))
{
return;
}


$db->delete_query('userfields', "ufid IN({$this->delete_uids})");
$db->delete_query('privatemessages', "uid IN({$this->delete_uids})");


$db->delete_query('userfields', "ufid IN({$this->delete_uids})");
$db->delete_query('privatemessages', "uid IN({$this->delete_uids})");

Zeile 1641Zeile 1662
		$db->update_query('reportedcontent', array('uid' => 0), "uid IN({$this->delete_uids})");

// Remove any of the user(s) uploaded avatars

		$db->update_query('reportedcontent', array('uid' => 0), "uid IN({$this->delete_uids})");

// Remove any of the user(s) uploaded avatars

		$query = $db->simple_select('users', 'avatar', "uid IN({$this->delete_uids}) AND avatartype='upload'");
while($avatar = $db->fetch_field($query, 'avatar'))

		require_once MYBB_ROOT.'inc/functions_upload.php';
foreach(explode(',', $this->delete_uids) as $uid)

		{

		{

			$avatar = substr($avatar, 2, -20);
@unlink(MYBB_ROOT.$avatar);

			remove_avatars($uid);


		}
}


		}
}


Zeile 1655Zeile 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;


	{
global $db, $plugins, $mybb;


		if($delete_uids != false)
{
$this->delete_uids = array_map('intval', (array)$delete_uids);

		if($delete_uids != false)
{
$this->delete_uids = array_map('intval', (array)$delete_uids);

Zeile 1678Zeile 1698
		$moderation = new Moderation();

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

		$moderation = new Moderation();

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

 

if(empty($this->delete_uids))
{
return;
}


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


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

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

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

			"aim" => "",

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

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

Zeile 1748Zeile 1772
		}

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

		}

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

 

if(empty($this->delete_uids))
{
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_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'], array('signature_parse' => '1'));
}
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;

	}
}

	}
}