Vergleich inc/datahandlers/user.php - 1.8.23 - 1.8.38

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


			if(empty($referrer['uid']))

			if(!$referrer)

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

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

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

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

		}
else

		}
else

		{
$user['referrer_uid'] = 0;

		{
$user['referrer_uid'] = 0;

		}

		}


return true;
}


return true;
}





	/**
* Verifies user options.
*

	/**
* Verifies user options.
*

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 658Zeile 689
			$this->verify_yesno_option($options, 'classicpostbit', 1);
}
else

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

		{

		{

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

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

		}

		}


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


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

		{

		{

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

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

Zeile 679Zeile 710
			if($options['dstcorrection'] < 0 || $options['dstcorrection'] > 2)
{
$options['dstcorrection'] = 0;

			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($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" && $options['threadmode'] != ''))

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

		{

		{

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


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


Zeile 705Zeile 736
			}
$explodedtpp = explode(",", $mybb->settings['usertppoptions']);
if(is_array($explodedtpp))

			}
$explodedtpp = explode(",", $mybb->settings['usertppoptions']);
if(is_array($explodedtpp))

			{

			{

				@asort($explodedtpp);
$biggest = $explodedtpp[count($explodedtpp)-1];
// Is the selected option greater than the allowed options?

				@asort($explodedtpp);
$biggest = $explodedtpp[count($explodedtpp)-1];
// Is the selected option greater than the allowed options?

Zeile 748Zeile 779
			{
$options['daysprune'] = 0;
}

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

		}

		}

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

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

	}

/**

	}

/**

	 * Verifies if a registration date is valid or not.
*
* @return boolean True when valid, false when invalid.

	 * Verifies if a registration date is valid or not.
*
* @return boolean True when valid, false when invalid.

Zeile 766Zeile 797
		if($regdate <= 0)
{
$regdate = TIME_NOW;

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

		}
return true;
}

/**

		}
return true;
}

/**

	 * Verifies if a last visit date is valid or not.
*
* @return boolean True when valid, false when invalid.

	 * Verifies if a last visit date is valid or not.
*
* @return boolean True when valid, false when invalid.

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

Zeile 786Zeile 817
			$lastvisit = TIME_NOW;
}
return true;

			$lastvisit = TIME_NOW;
}
return true;





	}

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

	}

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

	 *

	 *

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

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

Zeile 881Zeile 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 927Zeile 958

$timezones = get_supported_timezones();



$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 1090Zeile 1121

$user = &$this->data;



$user = &$this->data;


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

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

		foreach($array as $value)
{
if(!isset($user[$value]))

Zeile 1098Zeile 1129
				$user[$value] = '';
}
}

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

		











$array = array('subscriptionmethod', 'dstcorrection');
foreach($array as $value)
{
if(!isset($user['options'][$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 1152Zeile 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 1161Zeile 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" => '',

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

Zeile 1314Zeile 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 1328Zeile 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 1336Zeile 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['skype']))
{
$this->user_update_data['skype'] = $db->escape_string($user['skype']);

Zeile 1371Zeile 1411
		}
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 1451
		$old_user = get_user($user['uid']);

// If old user has new pmnotice and new user has = yes, keep old value

		$old_user = get_user($user['uid']);

// If old user has new pmnotice and new user has = yes, keep old value

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

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

		{
unset($this->user_update_data['pmnotice']);
}

		{
unset($this->user_update_data['pmnotice']);
}

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

		{
// 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 1441Zeile 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 1489Zeile 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 1497Zeile 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 1509Zeile 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 1530Zeile 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 1571Zeile 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 1656Zeile 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 1728Zeile 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 1770Zeile 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 1786Zeile 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'],
'allow_mycode' => $mybb->settings['sigmycode'],

		$parser_options = array(
'allow_html' => $mybb->settings['sightml'],
'allow_mycode' => $mybb->settings['sigmycode'],

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

			}
}


			}
}