Vergleich inc/datahandlers/user.php - 1.6.0 - 1.6.8

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: user.php 5172 2010-08-02 23:13:03Z RyanGordon $

 * $Id: user.php 5828 2012-05-08 16:06:16Z Tomm $

 */

// Disallow direct access to this file for security reasons

 */

// Disallow direct access to this file for security reasons

Zeile 70Zeile 70

// Fix bad characters
$username = trim_blank_chrs($username);


// Fix bad characters
$username = trim_blank_chrs($username);

		$username = str_replace(array(unicode_chr(160), unicode_chr(173), unicode_chr(0xCA), dec_to_utf8(8238), dec_to_utf8(8237), dec_to_utf8(8203)), array(" ", "-", "", "", "", ""), $username);

		$username = str_replace(array(unichr(160), unichr(173), unichr(0xCA), dec_to_utf8(8238), dec_to_utf8(8237), dec_to_utf8(8203)), array(" ", "-", "", "", "", ""), $username);


// Remove multiple spaces from the username
$username = preg_replace("#\s{2,}#", " ", $username);


// Remove multiple spaces from the username
$username = preg_replace("#\s{2,}#", " ", $username);

Zeile 382Zeile 382
		else if($birthday['year'] == date("Y"))
{
// Error if birth date is in future

		else if($birthday['year'] == date("Y"))
{
// Error if birth date is in future

			if($birthday['month'] > date("m") || ($birthday['month'] == date("m") && $bithday['day'] > date("d")))

			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 395Zeile 395
			$this->set_error("invalid_birthday_coppa");
return false;
}

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

		elseif(($mybb->settings['coppa'] == "deny" || $mybb->settings['coppa'] == "enabled") && $birthday['year'] > (date("Y")-13))

		elseif($mybb->settings['coppa'] == "deny" && $birthday['year'] > (date("Y")-13))

		{
$this->set_error("invalid_birthday_coppa2");
return false;

		{
$this->set_error("invalid_birthday_coppa2");
return false;

Zeile 464Zeile 464
		$options = array(
'order_by' => 'disporder'
);

		$options = array(
'order_by' => 'disporder'
);

		$query = $db->simple_select('profilefields', 'name, type, fid, required', $editable, $options);

		$query = $db->simple_select('profilefields', 'name, type, fid, required, maxlength', $editable, $options);


// Then loop through the profile fields.
while($profilefield = $db->fetch_array($query))


// Then loop through the profile fields.
while($profilefield = $db->fetch_array($query))

Zeile 477Zeile 477
			// 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")
{

				if(trim($profile_fields[$field]) == "" && $profilefield['required'] == 1 && !defined('IN_ADMINCP'))

				if(trim($profile_fields[$field]) == "" && $profilefield['required'] == 1 && !defined('IN_ADMINCP') && THIS_SCRIPT != "modcp.php")

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

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

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

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

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

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

Zeile 527Zeile 527
			}
else
{

			}
else
{

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


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

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

		return true;
}

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

	*

	*

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

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





		$user = &$this->data;

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

		$user = &$this->data;

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

		{

		{

			$query = $db->simple_select('users', 'uid', "username='".$db->escape_string($user['referrer'])."'", array('limit' => 1));
$referrer = $db->fetch_array($query);
if(!$referrer['uid'])

			$query = $db->simple_select('users', 'uid', "username='".$db->escape_string($user['referrer'])."'", array('limit' => 1));
$referrer = $db->fetch_array($query);
if(!$referrer['uid'])

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

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

			}

			}

		}

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

		}

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

		{

		{

			$options['dst'] = 1;

			$options['dst'] = 1;

		}

		}

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

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

		}


		}


		if(isset($options['showcodebuttons']))
{
$options['showcodebuttons'] = intval($options['showcodebuttons']);

		if(isset($options['showcodebuttons']))
{
$options['showcodebuttons'] = intval($options['showcodebuttons']);

Zeile 647Zeile 652
			else
{
$options['threadmode'] = 'linear';

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

			}

			}

		}

// Verify the "threads per page" option.

		}

// Verify the "threads per page" option.

Zeile 658Zeile 663
			{
@asort($explodedtpp);
$biggest = $explodedtpp[count($explodedtpp)-1];

			{
@asort($explodedtpp);
$biggest = $explodedtpp[count($explodedtpp)-1];

				// Is the selected option greater than the allowed options?

				// Is the selected option greater than the allowed options?

				if($options['tpp'] > $biggest)
{
$options['tpp'] = $biggest;

				if($options['tpp'] > $biggest)
{
$options['tpp'] = $biggest;

Zeile 681Zeile 686
				}
}
$options['ppp'] = intval($options['ppp']);

				}
}
$options['ppp'] = intval($options['ppp']);

		}

		}

		// Is our selected "days prune" option valid or not?
if($this->method == "insert" || array_key_exists('daysprune', $options))
{

		// Is our selected "days prune" option valid or not?
if($this->method == "insert" || array_key_exists('daysprune', $options))
{

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

$regdate = intval($regdate);

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

$regdate = intval($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)
{
$regdate = TIME_NOW;

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

Zeile 714Zeile 719

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


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

	 *

	 *

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

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

Zeile 745Zeile 750
		if($lastactive <= 0)
{
$lastactive = TIME_NOW;

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

		}
return true;


		}
return true;


	}

/**

	}

/**

Zeile 758Zeile 763
	function verify_away()
{
global $mybb;

	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 || $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 || $user['away']['away'] != 1)

Zeile 792Zeile 797
	function verify_language()
{
global $lang;

	function verify_language()
{
global $lang;


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

// An invalid language has been specified?


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

// An invalid language has been specified?

		if($language != '' && !$lang->language_exists($language))
{
$this->set_error("invalid_language");

		if($language != '' && !$lang->language_exists($language))
{
$this->set_error("invalid_language");

Zeile 925Zeile 930
			$this->verify_checkfields();
}


			$this->verify_checkfields();
}


		if(method_exists($plugins, "run_hooks_by_ref"))
{
$plugins->run_hooks_by_ref("datahandler_user_validate", $this);
}

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




		
// We are done validating, return.
$this->set_validated(true);

		
// We are done validating, return.
$this->set_validated(true);

Zeile 1039Zeile 1041
			$this->user_insert_data['dst'] = 0;
}


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


		if(method_exists($plugins, "run_hooks_by_ref"))
{
$plugins->run_hooks_by_ref("datahandler_user_insert", $this);
}

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




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


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


Zeile 1246Zeile 1245
			unset($this->user_update_data['pmnotice']);
}


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


		if(method_exists($plugins, "run_hooks_by_ref"))
{
$plugins->run_hooks_by_ref("datahandler_user_update", $this);
}

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




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

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

Zeile 1263Zeile 1259
		}

$cache->update_moderators();

		}

$cache->update_moderators();

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

		if(isset($user['bday']) || isset($user['username']))

		{
$cache->update_birthdays();
}

		{
$cache->update_birthdays();
}