Vergleich inc/datahandlers/user.php - 1.2.1 - 1.2.4

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html
*

 * $Id: user.php 2280 2006-09-27 12:21:17Z chris $

 * $Id: user.php 2663 2007-01-21 18:30:14Z Tikitiki $

 */

/**

 */

/**

Zeile 76Zeile 76
		}

// Check if the username belongs to the list of banned usernames.

		}

// Check if the username belongs to the list of banned usernames.

		$bannedusernames = get_banned_usernames();
if(in_array($username, $bannedusernames))

		if(is_banned_username($username))


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

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

Zeile 111Zeile 110

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



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


		$query = $db->simple_select(TABLE_PREFIX."users", "COUNT(uid) AS count", "username='".$db->escape_string($username)."'");

		$query = $db->simple_select(TABLE_PREFIX."users", "COUNT(uid) AS count", "LOWER(username)='".$db->escape_string(strtolower($username))."'");

		$user_count = $db->fetch_field($query, "count");
if($user_count > 0)
{

		$user_count = $db->fetch_field($query, "count");
if($user_count > 0)
{

Zeile 215Zeile 214
		}

// Check banned emails

		}

// Check banned emails

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

		if(is_banned_email($user['email']))


		{

		{

			foreach($bannedemails as $bannedemail)
{
$bannedemail = strtolower(trim($bannedemail));
if($bannedemail != '')
{
if(strstr($user['email'], $bannedemail) != '')
{
$this->set_error('banned_email');
return false;
}
}
}

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











		}

// If we have an "email2", verify it matches the existing email

		}

// If we have an "email2", verify it matches the existing email

Zeile 359Zeile 347
		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

			$user['bday'] = $birthday['day']."-".$birthday['month'];

			$user['bday'] = $birthday['day']."-".$birthday['month']."-";

		}
else
{

		}
else
{

Zeile 384Zeile 372
		// Loop through profile fields checking if they exist or not and are filled in.
$userfields = array();
$comma = '';

		// Loop through profile fields checking if they exist or not and are filled in.
$userfields = array();
$comma = '';

 
		$editable = '';

if(!$this->data['profile_fields_editable'])
{
$editable = "editable='yes'";
}


// Fetch all profile fields first.
$options = array(
'order_by' => 'disporder'
);


// Fetch all profile fields first.
$options = array(
'order_by' => 'disporder'
);

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

		$query = $db->simple_select(TABLE_PREFIX.'profilefields', 'name, type, fid, required', $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 398Zeile 392
			$thing = explode("\n", $profilefield['type'], "2");
$type = trim($thing[0]);
$field = "fid{$profilefield['fid']}";

			$thing = explode("\n", $profilefield['type'], "2");
$type = trim($thing[0]);
$field = "fid{$profilefield['fid']}";





			// If the profile field is required, but not filled in, present error.

			// If the profile field is required, but not filled in, present error.

			if(!$profile_fields[$field] && $profilefield['required'] == "yes" && !$proferror)

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

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

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

Zeile 422Zeile 416
						$options .= "\n";
}
$options .= $db->escape_string($value);

						$options .= "\n";
}
$options .= $db->escape_string($value);

				}
}

				}
}

			else if($type == "select" || $type == "radio")
{
$expoptions = explode("\n", $thing[1]);

			else if($type == "select" || $type == "radio")
{
$expoptions = explode("\n", $thing[1]);

Zeile 431Zeile 425
				if(!in_array(htmlspecialchars_uni($profile_fields[$field]), $expoptions) && $profile_fields[$field] != "")
{
$this->set_error('bad_profile_field_values', array($profilefield['name']));

				if(!in_array(htmlspecialchars_uni($profile_fields[$field]), $expoptions) && $profile_fields[$field] != "")
{
$this->set_error('bad_profile_field_values', array($profilefield['name']));

				}
$options = $db->escape_string($profile_fields[$field]);
}

				}
$options = $db->escape_string($profile_fields[$field]);
}

			else
{
$options = $db->escape_string($profile_fields[$field]);

			else
{
$options = $db->escape_string($profile_fields[$field]);

Zeile 451Zeile 445
	*/
function verify_referrer()
{

	*/
function verify_referrer()
{

		global $db;

		global $db, $mybb;


$user = &$this->data;



$user = &$this->data;


Zeile 470Zeile 464
			}
}
$user['referrer_uid'] = $referrer['uid'];

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





		return true;
}


		return true;
}


Zeile 482Zeile 476
	function verify_options()
{
$options = &$this->data['options'];

	function verify_options()
{
$options = &$this->data['options'];





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

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

Zeile 498Zeile 492
		$this->verify_yesno_option($options, 'showquickreply', 'yes');
$this->verify_yesno_option($options, 'showredirect', 'yes');


		$this->verify_yesno_option($options, 'showquickreply', 'yes');
$this->verify_yesno_option($options, 'showredirect', 'yes');


		$options['showcodebuttons'] = intval($options['showcodebuttons']);
if($this->method == "insert" || (array_key_exists('showcodebuttons', $options) && $options['showcodebuttons'] != '0'))
{
$options['showcodebuttons'] = 1;
}









		if(isset($options['showcodebuttons']))
{
$options['showcodebuttons'] = intval($options['showcodebuttons']);
if($options['showcodebuttons'] != 0)
{
$options['showcodebuttons'] = 1;
}
}
else if($this->method == "insert")
{
$options['showcodebuttons'] = 1;
}


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

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

Zeile 523Zeile 525
				}
}
$options['tpp'] = intval($options['tpp']);

				}
}
$options['tpp'] = intval($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 548Zeile 550
			{
$options['daysprune'] = 0;
}

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

		}

		}

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


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


Zeile 560Zeile 562
	function verify_regdate()
{
$regdate = &$this->data['regdate'];

	function verify_regdate()
{
$regdate = &$this->data['regdate'];





		$regdate = intval($regdate);
// If the timestamp is below 0, set it to the current time.
if($regdate <= 0)

		$regdate = intval($regdate);
// If the timestamp is below 0, set it to the current time.
if($regdate <= 0)

Zeile 585Zeile 587
		if($lastvisit <= 0)
{
$lastvisit = time();

		if($lastvisit <= 0)
{
$lastvisit = time();

		}

		}

		return true;

}

		return true;

}

Zeile 621Zeile 623
		$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'] == "no" || $user['away']['away'] != 'yes')

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

		{

		{

			$user['away']['away'] = "no";
$user['away']['date'] = 0;
$user['away']['returndate'] = 0;

			$user['away']['away'] = "no";
$user['away']['date'] = 0;
$user['away']['returndate'] = 0;

Zeile 675Zeile 677
			$old_user = get_user($user['uid']);
}


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


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

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

		{
// If the username is the same - no need to verify
if(!$old_user['username'] || $user['username'] != $old_user['username'])

		{
// If the username is the same - no need to verify
if(!$old_user['username'] || $user['username'] != $old_user['username'])

Zeile 826Zeile 828
			"daysprune" => intval($user['options']['daysprune']),
"dateformat" => $db->escape_string($user['dateformat']),
"timeformat" => $db->escape_string($user['timeformat']),

			"daysprune" => intval($user['options']['daysprune']),
"dateformat" => $db->escape_string($user['dateformat']),
"timeformat" => $db->escape_string($user['timeformat']),

			"regip" => $user['regip'],

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

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

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

Zeile 834Zeile 836
			"returndate" => $user['away']['returndate'],
"awayreason" => $db->escape_string($user['away']['awayreason']),
"notepad" => $db->escape_string($user['notepad']),

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

			"referrer" => intval($user['referrer_uid'])





			"referrer" => intval($user['referrer_uid']),
"buddylist" => '',
"ignorelist" => '',
"pmfolders" => '',
"notepad" => ''

		);

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

		);

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

Zeile 843Zeile 849
		$this->uid = $db->insert_id();

$user['user_fields']['ufid'] = $this->uid;

		$this->uid = $db->insert_id();

$user['user_fields']['ufid'] = $this->uid;

 
		
$query = $db->query("SHOW FIELDS FROM ".TABLE_PREFIX."userfields");
while($field = $db->fetch_array($query))
{
if($field['Field'] == 'ufid' || array_key_exists($field['Field'], $user['user_fields']))
{
continue;
}
$user['user_fields'][$field['Field']] = '';
}


		$db->insert_query(TABLE_PREFIX."userfields", $user['user_fields']);

// Update forum stats

		$db->insert_query(TABLE_PREFIX."userfields", $user['user_fields']);

// Update forum stats

Zeile 864Zeile 881
	function update_user()
{
global $db, $plugins;

	function update_user()
{
global $db, $plugins;

 



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


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

Zeile 871Zeile 889
			die("The user needs to be validated before inserting it into the DB.");
}
if(count($this->get_errors()) > 0)

			die("The user needs to be validated before inserting it into the DB.");
}
if(count($this->get_errors()) > 0)

		{

		{

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


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


Zeile 899Zeile 917
			$this->user_update_data['postnum'] = intval($user['postnum']);
}
if(isset($user['avatar']))

			$this->user_update_data['postnum'] = intval($user['postnum']);
}
if(isset($user['avatar']))

		{

		{

			$this->user_update_data['avatar'] = $db->escape_string($user['avatar']);
$this->user_update_data['avatartype'] = $db->escape_string($user['avatartype']);
}

			$this->user_update_data['avatar'] = $db->escape_string($user['avatar']);
$this->user_update_data['avatartype'] = $db->escape_string($user['avatartype']);
}

Zeile 918Zeile 936
		if(isset($user['usertitle']))
{
$this->user_update_data['usertitle'] = $db->escape_string(htmlspecialchars_uni($user['usertitle']));

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

		}

		}

		if(isset($user['regdate']))
{
$this->user_update_data['regdate'] = intval($user['regdate']);

		if(isset($user['regdate']))
{
$this->user_update_data['regdate'] = intval($user['regdate']);

Zeile 980Zeile 998
			$this->user_update_data['regip'] = $db->escape_string($user['regip']);
}
if(isset($user['language']))

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

		{

		{

			$this->user_update_data['language'] = $user['language'];
}
if(isset($user['away']))

			$this->user_update_data['language'] = $user['language'];
}
if(isset($user['away']))

Zeile 1005Zeile 1023
		// 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']);


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







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

if(count($this->user_update_data) < 1)
{
return false;
}


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

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





		// Maybe some userfields need to be updated?
if(is_array($user['user_fields']))
{

		// Maybe some userfields need to be updated?
if(is_array($user['user_fields']))
{

Zeile 1017Zeile 1040
			$fields = $db->fetch_array($query);
if(!$fields['ufid'])
{

			$fields = $db->fetch_array($query);
if(!$fields['ufid'])
{

				$db->insert_query(TABLE_PREFIX."userfields", array('ufid' => $user['uid']));














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

$query = $db->query("SHOW FIELDS FROM ".TABLE_PREFIX."userfields");
while($field = $db->fetch_array($query))
{
if($field['Field'] == 'ufid')
{
continue;
}
$user_fields[$field['Field']] = '';
}
$db->insert_query(TABLE_PREFIX."userfields", $user_fields);

			}
$db->update_query(TABLE_PREFIX."userfields", $user['user_fields'], "ufid='{$user['uid']}'");
}

			}
$db->update_query(TABLE_PREFIX."userfields", $user['user_fields'], "ufid='{$user['uid']}'");
}