Vergleich inc/datahandlers/user.php - 1.8.22 - 1.8.31

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 440Zeile 440
			$this->set_error("invalid_birthday_privacy");
return false;
}

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

		return true;
}











		else if ($birthdayprivacy == 'age')
{
$birthdayyear = &$this->data['birthday']['year'];
if(empty($birthdayyear))
{
$this->set_error("conflicted_birthday_privacy");
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 455Zeile 464
		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 true;
}

/**

			return false;
}

return true;
}

/**

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

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

Zeile 475Zeile 484
			$this->set_error("invalid_threadnum");
return false;
}

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





		return true;
}

/**
* Verifies if a profile fields are filled in correctly.

		return true;
}

/**
* Verifies if a profile fields are filled in correctly.

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

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

	function verify_profile_fields()
{
global $db, $cache;

	function verify_profile_fields()
{
global $db, $cache;

Zeile 506Zeile 515
					$profilefield['editableby'] = -1;
}


					$profilefield['editableby'] = -1;
}


				if(!is_member($profilefield['editableby'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups'])))
{
continue;
}



















				if(isset($user['usergroup']))
{
$usergroup = $user['usergroup'];
}
else
{
$usergroup = '';
}
if(isset($user['additionalgroups']))
{
$additionalgroups = $user['additionalgroups'];
}
else
{
$additionalgroups = '';
}

if(!is_member($profilefield['editableby'], array('usergroup' => $usergroup, 'additionalgroups' => $additionalgroups)))
{
continue;
}


				// Does this field have a minimum post count?
if(!isset($this->data['profile_fields_editable']) && !empty($profilefield['postnum']) && $profilefield['postnum'] > $user['postnum'])
{
continue;
}

				// Does this field have a minimum post count?
if(!isset($this->data['profile_fields_editable']) && !empty($profilefield['postnum']) && $profilefield['postnum'] > $user['postnum'])
{
continue;
}





				$profilefield['type'] = htmlspecialchars_uni($profilefield['type']);
$profilefield['name'] = htmlspecialchars_uni($profilefield['name']);
$thing = explode("\n", $profilefield['type'], "2");

				$profilefield['type'] = htmlspecialchars_uni($profilefield['type']);
$profilefield['name'] = htmlspecialchars_uni($profilefield['name']);
$thing = explode("\n", $profilefield['type'], "2");

Zeile 526Zeile 552
				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 603Zeile 629
		$user = &$this->data;

// Does the referrer exist or not?

		$user = &$this->data;

// Does the referrer exist or not?

		if($mybb->settings['usereferrals'] == 1 && $user['referrer'] != '')

		if($mybb->settings['usereferrals'] == 1 && !empty($user['referrer']))

		{
$referrer = get_user_by_username($user['referrer']);


		{
$referrer = get_user_by_username($user['referrer']);


Zeile 614Zeile 640
			}

$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 633Zeile 659
		global $mybb;

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

		global $mybb;

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

 

if(!is_array($options))
{
$options = array();
}


// Verify yes/no options.
$this->verify_yesno_option($options, 'allownotices', 1);


// Verify yes/no options.
$this->verify_yesno_option($options, 'allownotices', 1);

Zeile 652Zeile 683
		$this->verify_yesno_option($options, 'sourceeditor', 0);
$this->verify_yesno_option($options, 'buddyrequestspm', 1);
$this->verify_yesno_option($options, 'buddyrequestsauto', 0);

		$this->verify_yesno_option($options, 'sourceeditor', 0);
$this->verify_yesno_option($options, 'buddyrequestspm', 1);
$this->verify_yesno_option($options, 'buddyrequestsauto', 0);





		if($mybb->settings['postlayout'] == 'classic')

		if($mybb->settings['postlayout'] == 'classic')

		{

		{

			$this->verify_yesno_option($options, 'classicpostbit', 1);
}
else

			$this->verify_yesno_option($options, 'classicpostbit', 1);
}
else

Zeile 673Zeile 704
		}

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;
}
elseif($options['dstcorrection'] == 0)
{
$options['dst'] = 0;
}

			}















		if($this->method == "insert" || (isset($options['threadmode']) && $options['threadmode'] != "linear" && $options['threadmode'] != "threaded"))
{
if($mybb->settings['threadusenetstyle'])
{
$options['threadmode'] = 'threaded';
}
else

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







			{

			{

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





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

			}

			}

 
		}

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

		}

// Verify the "threads per page" option.
if($this->method == "insert" || (array_key_exists('tpp', $options) && $mybb->settings['usertppoptions']))
{
if(!isset($options['tpp']))

		}

// Verify the "threads per page" option.
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 747Zeile 771
		if($this->method == "insert" || array_key_exists('daysprune', $options))
{
if(!isset($options['daysprune']))

		if($this->method == "insert" || array_key_exists('daysprune', $options))
{
if(!isset($options['daysprune']))

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

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

			$options['daysprune'] = (int)$options['daysprune'];
if($options['daysprune'] < 0)
{

			$options['daysprune'] = (int)$options['daysprune'];
if($options['daysprune'] < 0)
{

Zeile 791Zeile 815
		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.
*

	/**
* Verifies if a last active date is valid or not.
*

Zeile 804Zeile 828
	function verify_lastactive()
{
$lastactive = &$this->data['lastactive'];

	function verify_lastactive()
{
$lastactive = &$this->data['lastactive'];





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

Zeile 812Zeile 836
			$lastactive = TIME_NOW;
}
return true;

			$lastactive = TIME_NOW;
}
return true;





	}

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

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

Zeile 839Zeile 863
			// Validate the awayreason length, since the db holds 200 chars for this field
$reasonlength = my_strlen($user['away']['awayreason']);
if($reasonlength > 200)

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

				$this->set_error("away_too_long", array($reasonlength - 200));

				return false;
}


				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 859Zeile 883

/**
* 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()
{

	 */
function verify_language()
{

Zeile 888Zeile 912

$user = &$this->data;



$user = &$this->data;


		if($user['style'])

		if(!empty($user['style']))

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


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


Zeile 928Zeile 952
	 */
function verify_timezone()
{

	 */
function verify_timezone()
{

 
		global $mybb;


		$user = &$this->data;

$timezones = get_supported_timezones();


		$user = &$this->data;

$timezones = get_supported_timezones();


		if(!array_key_exists($user['timezone'], $timezones))

		if(!isset($user['timezone']) || !array_key_exists($user['timezone'], $timezones))

		{
$user['timezone'] = $mybb->settings['timezoneoffset'];
return false;

		{
$user['timezone'] = $mybb->settings['timezoneoffset'];
return false;

Zeile 949Zeile 975
	function validate_user()
{
global $mybb, $plugins;

	function validate_user()
{
global $mybb, $plugins;





		$user = &$this->data;

		$user = &$this->data;





		// First, grab the old user details if this user exists
if(!empty($user['uid']))
{
$old_user = get_user($user['uid']);

		// First, grab the old user details if this user exists
if(!empty($user['uid']))
{
$old_user = get_user($user['uid']);

		}

		}


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


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

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

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

			}
}

			}
}

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

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

Zeile 1020Zeile 1046
			$this->verify_options();
}
if($this->method == "insert" || array_key_exists('regdate', $user))

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

		{

		{

			$this->verify_regdate();

			$this->verify_regdate();

		}

		}

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

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

		{

		{

			$this->verify_lastvisit();

			$this->verify_lastvisit();

		}

		}

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

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

		{

		{

			$this->verify_lastactive();

			$this->verify_lastactive();

		}

		}

		if($this->method == "insert" || array_key_exists('away', $user))
{
$this->verify_away();
}
if($this->method == "insert" || array_key_exists('language', $user))

		if($this->method == "insert" || array_key_exists('away', $user))
{
$this->verify_away();
}
if($this->method == "insert" || array_key_exists('language', $user))

		{

		{

			$this->verify_language();

			$this->verify_language();

		}

		}

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

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

		{

		{

			$this->verify_timezone();

			$this->verify_timezone();

		}

		}

		if($this->method == "insert" && array_key_exists('regcheck1', $user) && array_key_exists('regcheck2', $user))

		if($this->method == "insert" && array_key_exists('regcheck1', $user) && array_key_exists('regcheck2', $user))

		{

		{

			$this->verify_checkfields();

			$this->verify_checkfields();

		}

		}

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

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

		{

		{

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

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

		}


		}


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

// We are done validating, return.

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

// We are done validating, return.

Zeile 1069Zeile 1095
			return false;
}
else

			return false;
}
else

		{

		{

			return true;
}
}

			return true;
}
}





	/**
* Inserts a user into the database.
*

	/**
* Inserts a user into the database.
*

Zeile 1085Zeile 1111

// Yes, validating is required.
if(!$this->get_validated())


// Yes, validating is required.
if(!$this->get_validated())

		{

		{

			die("The user needs to be validated before inserting it into the DB.");

			die("The user needs to be validated before inserting it into the DB.");

		}

		}

		if(count($this->get_errors()) > 0)

		if(count($this->get_errors()) > 0)

		{

		{

			die("The user is not valid.");

			die("The user is not valid.");

		}

$user = &$this->data;










		}

$user = &$this->data;

$array = array('postnum', 'threadnum', 'avatar', 'avatartype', 'additionalgroups', 'displaygroup', 'icq', 'skype', 'google', 'bday', 'signature', 'style', 'dateformat', 'timeformat', 'notepad', 'regip', 'lastip', 'coppa_user');
foreach($array as $value)
{
if(!isset($user[$value]))
{
$user[$value] = '';
}
}





		$array = array('postnum', 'threadnum', 'avatar', 'avatartype', 'additionalgroups', 'displaygroup', 'icq', 'skype', 'google', 'bday', 'signature', 'style', 'dateformat', 'timeformat', 'notepad');

		$array = array('subscriptionmethod', 'dstcorrection');

		foreach($array as $value)
{

		foreach($array as $value)
{

			if(!isset($user[$value]))

			if(!isset($user['options'][$value]))

			{

			{

				$user[$value] = '';

				$user['options'][$value] = '';

			}
}

			}
}

		



		// If user is being created from ACP, there is no last visit or last active
if(defined('IN_ADMINCP'))
{

		// If user is being created from ACP, there is no last visit or last active
if(defined('IN_ADMINCP'))
{

Zeile 1157Zeile 1192
			"dateformat" => $db->escape_string($user['dateformat']),
"timeformat" => $db->escape_string($user['timeformat']),
"regip" => $db->escape_binary($user['regip']),

			"dateformat" => $db->escape_string($user['dateformat']),
"timeformat" => $db->escape_string($user['timeformat']),
"regip" => $db->escape_binary($user['regip']),

 
			"lastip" => $db->escape_binary($user['lastip']),

			"language" => $db->escape_string($user['language']),
"showcodebuttons" => (int)$user['options']['showcodebuttons'],
"sourceeditor" => (int)$user['options']['sourceeditor'],

			"language" => $db->escape_string($user['language']),
"showcodebuttons" => (int)$user['options']['showcodebuttons'],
"sourceeditor" => (int)$user['options']['sourceeditor'],

Zeile 1166Zeile 1202
			"awaydate" => (int)$user['away']['date'],
"returndate" => $user['away']['returndate'],
"awayreason" => $db->escape_string($user['away']['awayreason']),

			"awaydate" => (int)$user['away']['date'],
"returndate" => $user['away']['returndate'],
"awayreason" => $db->escape_string($user['away']['awayreason']),

			"notepad" => $db->escape_string($user['notepad']),

 
			"referrer" => (int)$user['referrer_uid'],
"referrals" => 0,
"buddylist" => '',
"ignorelist" => '',

			"referrer" => (int)$user['referrer_uid'],
"referrals" => 0,
"buddylist" => '',
"ignorelist" => '',

			"pmfolders" => '',

			"pmfolders" => "0**$%%$1**$%%$2**$%%$3**$%%$4**",

			"notepad" => '',
"warningpoints" => 0,
"moderateposts" => 0,

			"notepad" => '',
"warningpoints" => 0,
"moderateposts" => 0,

Zeile 1319Zeile 1354
			$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 1333Zeile 1368
		if(isset($user['signature']))
{
$this->user_update_data['signature'] = $db->escape_string($user['signature']);

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

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

Zeile 1341Zeile 1376
		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['skype']))
{
$this->user_update_data['skype'] = $db->escape_string($user['skype']);
}
if(isset($user['google']))

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

		{

		{

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

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

Zeile 1355Zeile 1390
			$this->user_update_data['birthday'] = $user['bday'];
}
if(isset($user['birthdayprivacy']))

			$this->user_update_data['birthday'] = $user['bday'];
}
if(isset($user['birthdayprivacy']))

		{

		{

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

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

Zeile 1363Zeile 1398
			$this->user_update_data['style'] = (int)$user['style'];
}
if(isset($user['timezone']))

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

		{

		{

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

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

		}

		}

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

		}

		}

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

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

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





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

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

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

Zeile 1407Zeile 1446
		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 1415Zeile 1454
		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']))

		{

		{

			return false;

			return false;

		}

		}


if(count($this->user_update_data) > 0)
{
// Actual updating happens here.
$db->update_query("users", $this->user_update_data, "uid='{$user['uid']}'");


if(count($this->user_update_data) > 0)
{
// Actual updating happens here.
$db->update_query("users", $this->user_update_data, "uid='{$user['uid']}'");

		}


		}


		$cache->update_moderators();
if(isset($user['bday']) || isset($user['username']))

		$cache->update_moderators();
if(isset($user['bday']) || isset($user['username']))

		{

		{

			$cache->update_birthdays();

			$cache->update_birthdays();

		}


		}


		if(isset($user['usergroup']) && (int)$user['usergroup'] == 5)

		if(isset($user['usergroup']) && (int)$user['usergroup'] == 5)

		{

		{

			$cache->update_awaitingactivation();
}


			$cache->update_awaitingactivation();
}


Zeile 1446Zeile 1485
		{
$query = $db->simple_select("userfields", "*", "ufid='{$user['uid']}'");
$fields = $db->fetch_array($query);

		{
$query = $db->simple_select("userfields", "*", "ufid='{$user['uid']}'");
$fields = $db->fetch_array($query);

			if(!$fields['ufid'])

			if(empty($fields['ufid']))

			{
$user_fields = array(
'ufid' => $user['uid']
);

			{
$user_fields = array(
'ufid' => $user['uid']
);





				$fields_array = $db->show_fields_from("userfields");
foreach($fields_array as $field)
{

				$fields_array = $db->show_fields_from("userfields");
foreach($fields_array as $field)
{

Zeile 1494Zeile 1533

/**
* Provides a method to completely delete a user.


/**
* Provides a method to completely delete a user.

	 *

	 *

	 * @param array $delete_uids Array of user information
* @param integer $prunecontent Whether if delete threads/posts or not
* @return array

	 * @param array $delete_uids Array of user information
* @param integer $prunecontent Whether if delete threads/posts or not
* @return array

Zeile 1502Zeile 1541
	function delete_user($delete_uids, $prunecontent=0)
{
global $db, $plugins, $mybb, $cache;

	function delete_user($delete_uids, $prunecontent=0)
{
global $db, $plugins, $mybb, $cache;





		// Yes, validating is required.
if(count($this->get_errors()) > 0)
{

		// Yes, validating is required.
if(count($this->get_errors()) > 0)
{

Zeile 1514Zeile 1553
		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'])

			{

			{

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

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

		}

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


		}

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


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

if(empty($this->delete_uids))

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

if(empty($this->delete_uids))

Zeile 1535Zeile 1574
		}

$this->delete_content();

		}

$this->delete_content();





		// Delete the user
$query = $db->delete_query('users', "uid IN({$this->delete_uids})");
$this->deleted_users = $db->affected_rows($query);

		// Delete the user
$query = $db->delete_query('users', "uid IN({$this->delete_uids})");
$this->deleted_users = $db->affected_rows($query);

Zeile 1576Zeile 1615
		}

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

		}

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





		// Update forums & threads if user is the lastposter
$db->update_query('forums', array('lastposteruid' => 0), "lastposteruid IN({$this->delete_uids})");
$db->update_query('threads', array('lastposteruid' => 0), "lastposteruid IN({$this->delete_uids})");

		// Update forums & threads if user is the lastposter
$db->update_query('forums', array('lastposteruid' => 0), "lastposteruid IN({$this->delete_uids})");
$db->update_query('threads', array('lastposteruid' => 0), "lastposteruid IN({$this->delete_uids})");

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

// Update cache

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

// Update cache

		$cache->update_banned();

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

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

Zeile 1662Zeile 1700
		// 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]);
}
}


	{
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 1734Zeile 1772
		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 1776Zeile 1814
		if(empty($this->delete_uids))
{
return;

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

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

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

 

if(!isset($this->data['signature']))
{
return true;
}


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

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

			'allow_mycode' => $mybb->settings['sigmycode'],
'allow_smilies' => $mybb->settings['sigsmilies'],
'allow_imgcode' => $mybb->settings['sigimgcode'],

Zeile 1835Zeile 1877
			$parsed_sig = $this->data['signature'];
}


			$parsed_sig = $this->data['signature'];
}


		$parsed_sig = preg_replace("#\s#", "", $parsed_sig);
$sig_length = my_strlen($parsed_sig);

if($sig_length > $mybb->settings['siglength'])

		if($mybb->settings['siglength'] > 0)




		{

		{

			$this->set_error('sig_too_long', array($mybb->settings['siglength']));

if($sig_length - $mybb->settings['siglength'] > 1)


			$parsed_sig = preg_replace("#\s#", "", $parsed_sig);
$sig_length = my_strlen($parsed_sig);

if($sig_length > $mybb->settings['siglength'])

			{

			{

				$this->set_error('sig_remove_chars_plural', array($sig_length-$mybb->settings['siglength']));
}
else
{
$this->set_error('sig_remove_chars_singular');






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

			}
}


			}
}