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

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

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


// MD5 the password
$user['md5password'] = md5($user['password']);

// Generate our salt
$user['salt'] = generate_salt();

// Combine the password and salt
$user['saltedpw'] = salt_password($user['md5password'], $user['salt']);

 

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

/**
* Verifies usergroup selections and other group details.


return true;
}

/**
* Verifies usergroup selections and other group details.

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

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

	*/
function verify_usergroup()
{

	*/
function verify_usergroup()
{

Zeile 238Zeile 233
	}
/**
* Verifies if an email address is valid or not.

	}
/**
* Verifies if an email address is valid or not.

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

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

	*/
function verify_email()
{

	*/
function verify_email()
{

Zeile 258Zeile 253
		if(!validate_email_format($user['email']))
{
$this->set_error('invalid_email_format');

		if(!validate_email_format($user['email']))
{
$this->set_error('invalid_email_format');

			return false;
}


			return false;
}


		// Check banned emails
if(is_banned_email($user['email'], true))
{

		// Check banned emails
if(is_banned_email($user['email'], true))
{

Zeile 303Zeile 298
	{
$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")

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








		{

		{

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

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


		}


		}


		if(!filter_var($website, FILTER_VALIDATE_URL))

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

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

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

Zeile 921Zeile 908
	}

/**

	}

/**

	 * 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 1000Zeile 987
			$this->verify_birthday();
}
if($this->method == "insert" || array_key_exists('postnum', $user))

			$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_postnum();
}
if($this->method == "insert" || array_key_exists('threadnum', $user))

Zeile 1054Zeile 1041
		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 1102Zeile 1093

$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 1195Zeile 1186
		if(is_array($pfcache))
{
foreach($pfcache as $profile_field)

		if(is_array($pfcache))
{
foreach($pfcache as $profile_field)

			{

			{

				if(array_key_exists("fid{$profile_field['fid']}", $user['user_fields']))
{
continue;

				if(array_key_exists("fid{$profile_field['fid']}", $user['user_fields']))
{
continue;

Zeile 1265Zeile 1256
		{
$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']))
{

Zeile 1319Zeile 1316
		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['icq']))

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

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

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

			$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['birthday'] = $user['bday'];
}
if(isset($user['birthdayprivacy']))

		if(isset($user['bday']))
{
$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['style'] = (int)$user['style'];

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

		}

		}

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

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

			$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']))
{
$this->user_update_data['regip'] = $db->escape_string($user['regip']);
}
if(isset($user['language']))

		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']);
}
if(isset($user['away']))
{

			$this->user_update_data['language'] = $db->escape_string($user['language']);
}
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 1386Zeile 1383
		if(isset($user['notepad']))
{
$this->user_update_data['notepad'] = $db->escape_string($user['notepad']);

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

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

		{

		{

			foreach($user['options'] as $option => $value)
{
$this->user_update_data[$option] = $value;

			foreach($user['options'] as $option => $value)
{
$this->user_update_data[$option] = $value;

Zeile 1590Zeile 1587
		$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 1606Zeile 1604
		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 1615Zeile 1613
					unset($this->delete_uids[$key]);
}
}

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

		



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


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


Zeile 1651Zeile 1649
		// Delete reports made to the profile or reputation of the deleted users (i.e. made by them)
$db->delete_query('reportedcontent', "type='reputation' AND id3 IN({$this->delete_uids}) OR type='reputation' AND id2 IN({$this->delete_uids})");
$db->delete_query('reportedcontent', "type='profile' AND id IN({$this->delete_uids})");

		// Delete reports made to the profile or reputation of the deleted users (i.e. made by them)
$db->delete_query('reportedcontent', "type='reputation' AND id3 IN({$this->delete_uids}) OR type='reputation' AND id2 IN({$this->delete_uids})");
$db->delete_query('reportedcontent', "type='profile' AND id 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})");


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


Zeile 1662Zeile 1660
			remove_avatars($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)
{

	{
global $db, $plugins, $mybb;

if($delete_uids != false)
{

			$this->delete_uids = array_map('intval', (array)$delete_uids);

foreach($this->delete_uids as $key => $uid)

			$this->delete_uids = array_map('intval', (array)$delete_uids);

foreach($this->delete_uids as $key => $uid)

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

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





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

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

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

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


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

if(empty($this->delete_uids))
{


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

if(empty($this->delete_uids))
{

			return;
}


			return;
}


Zeile 1738Zeile 1736
			}

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

			}

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

		}

		}


$update = array(
"website" => "",


$update = array(
"website" => "",

Zeile 1759Zeile 1757
			"avatar" => "",
'avatardimensions' => '',
'avatartype' => ''

			"avatar" => "",
'avatardimensions' => '',
'avatartype' => ''

		);


		);


		if($gid > 0)
{
$update["usergroup"] = (int)$gid;

		if($gid > 0)
{
$update["usergroup"] = (int)$gid;

Zeile 1771Zeile 1769
		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 1779Zeile 1777
		// Remove any of the user(s) uploaded avatars
require_once MYBB_ROOT.'inc/functions_upload.php';
foreach(explode(',', $this->delete_uids) as $uid)

		// Remove any of the user(s) uploaded avatars
require_once MYBB_ROOT.'inc/functions_upload.php';
foreach(explode(',', $this->delete_uids) as $uid)

		{

		{

			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;

	}
}

	}
}